method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
bc9e7e0d-2ab0-4700-b87d-af769a6a5650 | 7 | public int getPageNumber(Reference r) {
Page pg = (Page) library.getObject(r);
if (pg == null)
return -1;
// pg.init();
int globalIndex = 0;
Reference currChildRef = r;
Reference currParentRef = pg.getParentReference();
PageTree currParent = pg.getParen... |
8bd0566f-d1f7-4932-84b6-f62fdb70e4b6 | 9 | public boolean setInputFormat(Instances instanceInfo) throws Exception {
super.setInputFormat(instanceInfo);
m_DeltaCols.setUpper(getInputFormat().numAttributes() - 1);
int selectedCount = 0;
for (int i = getInputFormat().numAttributes() - 1; i >= 0; i--) {
if (m_DeltaCols.isInRange(i)) {
... |
d4af638c-28e7-48b3-85a0-9c06fab83640 | 6 | private MoveType getTradeMoveType(Settlement settlement) {
if (settlement instanceof Colony) {
return (getOwner().atWarWith(settlement.getOwner()))
? MoveType.MOVE_NO_ACCESS_WAR
: (!hasAbility("model.ability.tradeWithForeignColonies"))
? MoveType.MOVE_... |
b709bf45-3eb1-4aa5-90b4-487aba3f2bb2 | 7 | public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof HighLowRenderer)) {
return false;
}
HighLowRenderer that = (HighLowRenderer) obj;
if (this.drawOpenTicks != that.drawOpenTicks) {
return false;
... |
20f552a3-fa38-44c7-a730-bd24314e661f | 0 | public MyCustomEventPublisher(MyCustomEventListener listener) {
this.listener = listener;
} |
634b4590-b87d-4d68-95ba-5598a43d433d | 6 | @Override
public void executar() throws Exception
{
boolean goBack = false;
while ( !goBack )
{
mostrarOpcions();
int choice = readint("\nOPCIO: ");
switch (choice)
{
case 1:
... |
12ceaca2-1fd3-4c29-9bf2-cb1795e4d543 | 7 | public void mutePlayer(Client c, String name) {
if (!isOwner(c)) {
c.sendMessage("You do not have the power to do that!");
return;
}
if (clans[c.clanId] != null) {
for (int j = 0; j < clans[c.clanId].mutedMembers.length; j++) {
for(int i = 0; j < Config.MAX_PLAYERS; i++) {
if (Server.playerHandl... |
7f437a69-3744-4522-b43b-bed4e5f45418 | 8 | protected Neuron(Element neuronE, NeuralLayer layer) {
m_layer = layer;
m_ID = neuronE.getAttribute("id");
String bias = neuronE.getAttribute("bias");
if (bias != null && bias.length() > 0) {
m_bias = Double.parseDouble(bias);
}
String width = neuronE.get... |
216ad13e-715d-405e-b989-080d59191668 | 3 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Temperature other = (Temperature) obj;
if (this.unit != other.unit) {
return false;
}... |
24406b2f-4d60-4871-911b-0827211a2158 | 0 | public DataModel getDataModel() {
return dataModel;
} |
d01bfa52-02ef-464e-bf0c-c1bb873d5d36 | 9 | public boolean collidesWith(Placeable other)
{
boolean collidesX = (other.x < this.x && other.x + other.width >= this.x) || (other.x > this.x && this.x + this.width >= other.x) || other.x == this.x;
boolean collidesY = (other.y < this.y && other.y + other.width >= this.y) || (other.y > this.y && this.y + this.widt... |
5f94bbdd-d7c6-4ed3-801d-531d092d2cb1 | 6 | public void vizExportConceptTree(LogicObject concept, Module module) {
{ VizInfo self = this;
self.nodeColor = "palegreen";
self.vizExportConcept(concept, module);
self.nodeColor = "yellow";
self.vizAllowObject(concept);
{ LogicObject renamed_Super = null;
edu.isi.powerloom.Pl... |
68eff628-1b3d-4bab-8de5-1ae2add67119 | 3 | public SimpleExample() {
setTitle("Simple example");
setSize(300, 200);
setLocationRelativeTo(null);
setDefaultCloseOperation(EXIT_ON_CLOSE);
String s = (String)JOptionPane.showInputDialog(
this,
"Ge mig ett binärt tal, tack! MAX 4 STYCK... |
031cbdd8-9f6d-4619-bd0d-2f467d2de3fd | 0 | public void addTask(){
int counter=taskCounter.get().intValue();
counter++;
taskCounter.set(counter);
} |
afa18d84-674d-420b-b35c-d2305e401fc7 | 6 | public static void main(String[] args)
{
/* theme
try
{
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
}
catch(UnsupportedLookAndFeelException e)
{
}
catch(ClassNotFoundException e)
{
}
catch(InstantiationException e)
{
}
catch(Illega... |
3caa4728-4cc9-4492-98e7-27bec0791da1 | 9 | public String sample_frequency_string()
{
switch (h_sample_frequency)
{
case THIRTYTWO:
if (h_version == MPEG1)
return "32 kHz";
else if (h_version == MPEG2_LSF)
return "16 kHz";
else // SZD
return "8 kHz";
case FOURTYFOUR_POINT_ONE:
if (h_version == MPEG1)
return "... |
6668f7a5-3c29-4982-9efc-7c80c9d0c9d8 | 0 | public static int m_fht(final int n) {
return (int) Math.pow(2,Math.ceil(log(12.8*n,2)));
} |
348504b9-2ee3-4afd-863c-d63db8e5afaa | 1 | double VectorMin(double[] v) {
double sum = 0;
for (int i = 0; i < v.length; i++) {
sum = Math.min(v[i], sum);//*v[i];
}
return sum;//Math.sqrt(sum);
} |
7edb62ff-4b31-4893-bd58-2b2f46bf84a5 | 6 | public static Pair<Boolean, Pair<Integer,Integer>> check(Map<Integer, Pair<Double,String>> first, Map<Integer, Pair<Double,String>> second){
int firstVal = -1;
int secondVal = -1;
int counter = 0;
for(Map.Entry<Integer, Pair<Double,String>> f : first.entrySet()){
if(counter == 0){
firstVal = f.getKey();
... |
2903e687-1bd5-4cf3-beb3-a37306939313 | 6 | public void run() {
List<SQLStatement> sqlStatementsToLoad = new ArrayList<>();
int numberStatements;
//noinspection InfiniteLoopStatement
while (true) {
if (unloadedSQLStatements.size() > 0) {
sqlStatementsToLoad.clear();
... |
4c868dcd-ef8a-4af0-9839-c38ac33ddf98 | 0 | private void addExtras(JToolBar toolbar) {
toolbar.addSeparator();
toolbar.add(new TooltipAction("Complete",
"This will finish all expansion.") {
public void actionPerformed(ActionEvent e) {
controller.complete();
}
});
toolbar.add(new TooltipAction("Done?", "Are we finished?") {
public void ac... |
af588cb1-1391-41ae-b631-00017566bedd | 3 | public boolean isSorted()
{
boolean sorted = true;
// TODO: Determine if the array is sorted.
if (list.size() == 0)
{
return sorted;
}
else
{
String previous = list.get(0);
for (String each : list)
{
if (previous.... |
334c5579-7e5d-4343-a5c1-a135e1f07a40 | 2 | public void update(long nowTime) {
if (m_inScroll) {
long delta = nowTime - m_startTime;
if (delta < m_maxTime) {
double t = ((double)delta)/m_maxTime;
m_target.x = (int)(m_scrollTo.x * t + m_scrollFrom.x * (1.0 - t));
m_target.y = (int)(m_scrollTo.y * t + m_scrollFrom.y * (1.0 - t));
}
e... |
1b83e8d8-ca6c-41ef-bdbd-60f3065ba439 | 9 | public boolean atTerminator() {
if (!hasNext()) {
return true;
}
final char ch = peek();
return isSpace(ch) || isEndOfLine(ch) || ch == '.' || ch == ',' || ch == '|' || ch == ':' || ch == '(' || ch == ')' || rightDelimiter.charAt(0) == ch;
} |
4efc6943-6e63-45f0-9221-bbd5451c5a25 | 3 | @Override
public void cleanup()
{
if( ALSource != null )
{
try
{
// Stop playing the source:
AL10.alSourceStop( ALSource );
AL10.alGetError();
}
catch( Exception e )
{}
try
... |
af94cd6f-c16f-4d93-b945-495ff2b2f748 | 4 | public static int personneX(int travee,int orientation){
int centreX = centrePositionX(travee) ;
switch(orientation){
case Orientation.NORD :
centreX -= 10 ;
break ;
case Orientation.EST :
centreX -= 25 ;
break ;
case Orientation.SUD :
centreX -= 10 ;
break ;
case Orientation.OUE... |
6cd3e023-4fb4-4477-8c1b-96017692842d | 9 | @Override
public int joinRoom(String roomName, short roomKind) throws RemoteException {
// TODO Auto-generated method stub
String check="";
int roomID=-1;
int i;
for(i=0;i<rooms.size();i++)
{
check=(String) rooms.get(i).get(0);
if(check.equals(roomName)==true)
{
roomID=i;
i=rooms.size();
... |
683836a7-4e9b-4edf-a5d3-24f4809989b5 | 2 | public void drawText(Graphics2D g) {
// We don't want to corrupt the graphics environs with our
// affine transforms!
Graphics2D g2 = (Graphics2D) g.create();
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
g2.transform(affineToText);
// What about the text labe... |
88f4473c-70f4-4bea-9c7e-b507dba4f445 | 9 | @Override
public void execute(GameActor character, CharacterAction action) {
switch (action) {
case JUMPRIGHT:
if (character.isOnGround()) character.updateVelocity(7, -80);
else character.updateVelocity(7, 0);
character.setOnGround(false);
... |
bfe8f269-768e-4810-86f7-3cdf79bc46e3 | 4 | private boolean measurementIsValid(Measurement measurement, OpenCellIdCell cell, double r) {
double distanceToCellTower = Geom.sphericalDistance(
cell.getCellTowerCoordinates().getX(),
cell.getCellTowerCoordinates().getY(),
measurement.getCoordinates().getX(),
measurement.getCoordinates().getY()... |
f59f6b18-c54c-48e7-a1cc-fdaaa9501c5f | 0 | public Integer getIdHospital() {
return idHospital;
} |
335995d5-40eb-42cb-8121-cbd1f5e8379d | 2 | public void buyed()
{
for (int i=0; i<recruits.length; ++i) {
recruits[i].updateRange();
}
for (int i=0; i<buys.length; ++i) {
buys[i].checkActive();
}
updateResources();
} |
3da089f9-1501-40b0-8f47-a898759d03a4 | 7 | private void processAfterLogin(int choice){
switch (choice){
case 1: logout();
break;
case 2: bookRepository.showAllBooks();
break;
case 3: movieStore.showAllMovies();
break;
case 4: getLibraryNumber(... |
44036560-ffcb-4141-960d-a06d60e3f5c0 | 3 | void doNewGame() {
if (gameInProgress) {
// If the current game is not over, it is an error to try
// to start a new game.
message = "You still have to finish this game!";
repaint();
return;
}
deck = new Deck(); // Create the deck and hands ... |
8fa04459-de75-4db9-9a39-d9d998e6f9e1 | 2 | public static <T extends Satellite> Satellite create(int id, Class<T> type, Planet primary) {
PropertyManager pm = new PropertyManager("config.properties");
Random rnd = new Random();
double satelliteMass = pm.getDoubleProperty("min.Satellite.Mass") + (pm.getDoubleProperty("max.Satellite.Mass")... |
95082d9c-61ae-4c02-9fd5-0346676867ea | 3 | private void dijkstraButtonClick(java.awt.event.ActionEvent evt) {
//GraphPoint[] gps = graph.getSelectedPoints();
// GraphElement[] ges;// = GraphElement[0];
// if (gps.length == 2) {
// ges = graph.getDijkstraPath(gps[0], gps[1]);
// } ... |
dc772aa4-7d68-4c92-8927-fec70151028b | 8 | public Long128 add(Long128 number) {
long lowerSum = myLowerDigits + number.myLowerDigits;
boolean carry = false;
// overflow
if ((lowerSum > 0 && myLowerDigits < 0 && number.myLowerDigits < 0) ||
(lowerSum < 0 && myLowerDigits > 0 && number.myLowerDigits > 0)) {
lowerSum = lowerSum & Long.MAX_VALU... |
864c2ec2-ebe3-4f9f-819e-7df953f6a214 | 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... |
94fe57f7-1e31-4482-9dbb-4bd9f119483b | 3 | public boolean isGlobalAdmin()
{
if (isOwner() == true)
return true;
else if (permission.has(player, "FC_Suite.admin"))
return true;
else if (player.isOp() == true)
return true;
return false;
} |
e2f4af9b-8f9c-49f7-9a0f-e76a25be3f01 | 3 | public String getName(int ID)
{
try {
int employeeID = ID;
if(employeeID > 0) {
if(employeeID < ReadFromFile.getNumberFromFile("employee.txt")) {
Employee [] checkEmployees = ReadFromFile.findAllEmployeeData();
return checkEmployees[employeeID-1].getFirstName() + " " + checkEmployees[employeeID-1... |
df03a1c6-54d3-4760-8192-50ef1911d3f1 | 4 | private ArrayList<Long> generateIdsForCondition(String indexName, String value)
{
ArrayList<Long> results = new ArrayList<>();
NodeReference node = DataWorker.GetNodeReference(indexGlobal);
String key = "";
while (true)
{
key = node.nextSubscript(indexName, value, key);
if (key.equals(""))
br... |
ea5b04d4-6b36-467b-9adb-cd44ca7b3388 | 5 | @Override
protected void paintTabBackground( Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h, boolean isSelected ){
Graphics2D g2D = (Graphics2D)g;
//colores degradados para los tabs
GradientPaint gradientSel = new GradientPaint( 0, 0, new Color(242,249,242), 0, y+h/2, n... |
27b407ba-f331-44a8-986e-24df17d0def7 | 7 | @Override
public boolean okMessage(final Environmental myHost, final CMMsg msg)
{
if(!super.okMessage(myHost, msg))
return false;
if((myHost instanceof MOB)&&(myHost == this.affected)&&(((MOB)myHost).location()!=null))
{
if((msg.sourceMinor()==CMMsg.TYP_SHUTDOWN)
||((msg.sourceMinor()==CMMsg.TYP_QUIT)&... |
649290dd-34f5-4318-9565-ce10ff419ddc | 2 | public static void printList(List<?> lst) {
System.out.println("Index\t Value");
for (int i = 0; i < lst.size(); i++) {
System.out.println(i + "\t " + lst.get(i));
}
} |
35a327df-04df-4ec8-96ba-8a0c7905491a | 4 | public Response handleObject(Request request) {
String interfaceClassName = metadata.getImplClass();
try {
Class<?> interfaceClazz = Class.forName(interfaceClassName);
return new Response(interfaceClazz.newInstance(),interfaceClazz);
} catch (ClassNotFoundException e) {
log.error("class not found o... |
335cea92-caea-4d58-b52e-f315ab29c5b8 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
VarDeclarationNode other = (VarDeclarationNode) obj;
if (identList == null) {
if (other.identList != null)
return false;
} else if (!... |
345b0394-9d81-4748-a5ed-f36f74e06e69 | 2 | public FloorItem FindItemByID(int ID)
{
FloorItem Return = null;
for(FloorItem Item : FloorItems.values())
{
if(Item.ID == ID)
{
Return = Item;
}
}
return Return;
} |
b919425c-ed99-41ae-8e12-d36df447fee5 | 4 | public void handlePacket(Packet packet) {
if (!handlers.containsKey(packet.getID())) {
throw new IllegalArgumentException("No handler for packet " + packet.getID());
}
if(!listeners.get(packet.getClass()).isEmpty()){
Iterator<PacketListener> it = listeners.get(packet.getC... |
2aaa763a-9c58-485c-befe-1eb743069f15 | 6 | public int evaluateGameBoard() {
int score = 0;
// scores for the positions
int mt_score = 0;
int ps_score = 0;
int mb_score = 0;
for (int i = 0; i < all_pieces.size(); i++) {
BoardPiece piece = all_pieces.get(i);
mt_score += m_table.get(piece.piece_type);
if (all_pieces.size() + oponents.size() >... |
d687e55c-ceb6-4156-9609-5d5fad15355c | 6 | public static List<Participant> getParticipants(int gameid) throws SQLException {
String sql = null;
Connection connection = null;
PreparedStatement query = null;
ResultSet results = null;
try {
sql = "SELECT gameid, participant.playerid, playername, points, notes fro... |
72d3efe6-ef10-457c-a097-f605fc51bf2a | 3 | @Override
public Map<String, String> getCompra(Cliente cliente, Funcionario funcionario){
Map<String, String> compra = new HashMap<>();
try{
conn = ConnectionFactory.getConnection();
String sql = "SELECT to_char(datacompra, 'dd/mm/yyyy') as datacompra, secao.nome as nome FRO... |
d6b378de-61cb-47c0-8e70-2efd248754f3 | 4 | public List<LinkedNode<T>> removeSubNode(T key) {
if (key == null)
return null;
List<LinkedNode<T>> searchResult = new ArrayList<LinkedNode<T>>();
List<LinkedNode<T>> removeResult = new ArrayList<LinkedNode<T>>();
for (LinkedNode<T> node : subNodes) {
if (key.equals(node.getValue())) {
searchResult.ad... |
dfe89360-0ae2-41f0-9df5-f7e73fc737d2 | 8 | public String getMimeType(String incUrl) {
if (incUrl.endsWith(".html") || incUrl.endsWith(".htm")) {
return "text/html";
} else if (incUrl.endsWith(".txt") || incUrl.endsWith(".java")) {
return "text/plain";
} else if (incUrl.endsWith(".gif")) {
return "image... |
b0b29fc2-3ab8-42b6-b79d-5883e4f92c87 | 7 | public ArrayList<String> getFileLists(String fn) {
if(fn.endsWith("/"))
fn.substring(0, fn.length()-1);
File file = new File(fn);
ArrayList<String> output = new ArrayList<String>();
if(file.exists()) {
if(file.isFile()) {
// Extract the folder part of the name
int dir_index = fn.lastIndexOf('/');... |
b9270e6b-7f75-49e8-91c2-214ed44b6fd5 | 1 | public static String reformat(String input) {
String output = input.replaceAll("@", "_").replaceAll("^", "_")
.replaceAll("\\*", "_");
if (input.contains("</table>"))
output = output.substring(0, output.indexOf("</table>"));
output = output.replaceAll("d><t", "d> <t").replaceAll("h><t", "h> <t")
.repla... |
b0886f3d-e97d-4a9c-8c7f-272cb50cd111 | 1 | public static void collapseToParent(Node currentNode) {
// Shorthand
JoeTree tree = currentNode.getTree();
OutlineLayoutManager layout = tree.getDocument().panel.layout;
Node parent = currentNode.getParent();
if (parent.isRoot()) {
// Collapse
currentNode.CollapseAllSubheads();
// Redraw and S... |
7a79e54f-750d-41b6-9980-5a12c460d397 | 1 | public FeedForwardNeuron(Layer previousLayer, List<Double> weigths)
throws WeigthNumberNotMatchException {
if (weigths.size() != previousLayer.getNeuronCount())
throw new WeigthNumberNotMatchException();
this.weigths = new Vector<Double>(weigths.size());
this.weigths.addAll(weigths);
previous = previousLa... |
70f2e0f8-6f38-48af-93c4-6d9d802743b7 | 8 | public synchronized static void sendMsg2One(UserInfo srcUser,MsgHead msg){
//1.Һ
if(msg.getType()==IMsgConstance.command_find){
//ߵĺб
Set<UserInfo> users=stList.keySet();
Iterator<UserInfo> its=users.iterator();
MsgFindResp mfr=new MsgFindResp();
mfr.setType(IMsgConstance.command_find_resp);
mfr.s... |
9ee709b2-d95d-40fe-8fff-73eb1cb23066 | 8 | void save()
{
try
{
long t1 = System.currentTimeMillis();
if (debug)
{
System.err.println("DEBUG: nntp: newsrc saving " +
file.getPath());
}
int bs = (groups.size() * 20); // guess an average line length
FileO... |
7e479646-58f4-4f8d-883b-0db0374307c8 | 8 | private void doEscape(String str)
throws IOException, SQLException, SyntaxException {
String rest = null;
if (str.length() > 2) {
rest = str.substring(2);
}
if (str.startsWith("\\d")) { // Display
if (rest == null){
throw new SyntaxException("\\d needs display arg");
}
display(rest);
} el... |
b33bfd56-15df-4162-95a5-355f3f06a887 | 2 | void register(CommandSender sender, Command cmd, String commandLabel, String[] args){
if(args.length==1){
plugin.error(sender, "/authy register (email) (phone number)");
}else if(args.length == 3){
}
} |
3626f1b8-6ecd-40ba-8942-a5f978d3d76c | 9 | public String nextToken() throws JSONException {
char c;
char q;
StringBuffer sb = new StringBuffer();
do {
c = next();
} while (Character.isWhitespace(c));
if (c == '"' || c == '\'') {
q = c;
for (;;) {
c = next();
... |
ceda9055-d282-40f7-8c4a-1f3ddc4a48a5 | 9 | public static void test_Gleitpunktzahl() {
/**********************************/
/* Test der Klasse Gleitpunktzahl */
/**********************************/
System.out.println("-----------------------------------------");
System.out.println("Test der Klasse Gleitpunktzahl");
/*
* Verglichen werden die Bi... |
d9b10ab2-8980-43b1-a3fb-a53aa49ec727 | 0 | public void setClassName(String className) {
this.className = className;
} |
59054145-b705-488f-a178-3bf41691dcc5 | 3 | public Image getImage(URL paramURL, String paramString)
{
InputStream localInputStream = getClass().getResourceAsStream("/" + paramString);
if (localInputStream == null)
{
return super.getImage(paramURL, paramString);
}
ByteArrayOutputStream localByteArrayOutputStream = new ByteArrayOutput... |
0a0ece2e-57e4-4e81-b9d7-e4f792064d9f | 6 | public static int insert(Statement stat, String table, HashMap<String, Object> values) throws SQLException {
String db_Name = DataBaseManager.getDb_name();
System.out.println("--------db_name----->>>>"+db_Name);
String fieldSql = "select COLUMN_NAME from information_schema.columns where table_n... |
a2c8216c-8a78-4fed-8ab6-2ee3c8a6e131 | 2 | */
public synchronized byte[] Final () {
byte bits[];
int index, padlen;
MD5State fin;
if (finals == null) {
fin = new MD5State(state);
bits = Encode(fin.count, 8);
index = (int) ((fin.count[0] >>> 3) & 0x3f);
padlen = (index < 56) ? (56 - index) : (120 - index);
... |
e79b46c0-656f-46ee-9c94-43b4e9fed787 | 8 | public void putAll( Map<? extends Byte, ? extends Character> map ) {
Iterator<? extends Entry<? extends Byte,? extends Character>> it =
map.entrySet().iterator();
for ( int i = map.size(); i-- > 0; ) {
Entry<? extends Byte,? extends Character> e = it.next();
this.put(... |
b4ca7ff9-4626-409b-adcd-0d0645ca580e | 0 | public static void main(String[] args) {
Client client = new Client();
client.test();
} |
cf37e046-1869-48e5-aa79-501a504d944a | 0 | @Test
public void runTestActivityLifecycle1() throws IOException {
InfoflowResults res = analyzeAPKFile("Lifecycle_ActivityLifecycle1.apk");
Assert.assertEquals(1, res.size());
} |
fbdd0ff1-cbc8-4abe-8aec-031c382ca5ee | 8 | public static String colorToString (final Color c)
{
try {
final Field[] fields = Color.class.getFields();
for (final Field f : fields) {
if (Modifier.isPublic(f.getModifiers())
&& Modifier.isFinal(f.getModifiers())
&& Modifier.isSt... |
22d6c870-6c85-4448-95c4-d8d83ca33840 | 5 | public double winPossibility(ArrayList<Action> history, int playerHandStrength) {
int numRaises = 0;
for(Action a : history) {
if(a == Action.RAISE) {
numRaises++;
}
}
int[] histogram = historyToHandStrength.get(numRaises);
int aphs = adjustedHandStrength(playerHandStrength);
if(histogram ==... |
7b6f0af9-db64-423c-bf26-6381319e107a | 8 | private boolean usesNetwork(Message message, SoftwareSystem system) {
try {
Component sender = (Component) message.getSender();
Component receiver = (Component) message.getReceiver();
HardwareSet senderHS = null, receiverHS = null;
for (DeployedComponent deployedComponent : system.getDeploymentAlternative... |
e3ae5a16-420a-434f-8e82-8c3340a93a02 | 3 | private AnswerCombination generateAnswerCombination(int black, int white) {
List<Token<AnswerColors>> tokens = new ArrayList<Token<AnswerColors>>();
for (int i = 0; i < black; i++) {
tokens.add(new Token<AnswerColors>(AnswerColors.BLACK));
}
for (int i = 0; i < white; i++) {
tokens.add(new... |
79ff69f6-8cab-4683-8c7c-ce51cf6666a6 | 4 | public OreVein[] getWorldData(World w){
if(data.containsKey(w))
return data.get(w);
else if ( conf.contains(w.getName()) ){
data.put(w, OreVein.loadConf( conf.getMapList( w.getName() ) ) );
return data.get(w);
}
else if( def!=null )
return ... |
4860c639-e06b-4e8f-a305-5fe23317d75c | 3 | @Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if(args.length == 1){
if(!(Plugin.getVoteManager().getVoteByPlayer(args[0]) == null)){
if(args[0].equalsIgnoreCase(sender.getName())){
sender.sendMessage("[RP] You can't vote for yo... |
0257e1ab-a6a8-4b8d-9574-023c68cc4dd6 | 8 | public void strongConnectedComponent(int adjacency_matrix[][])
{
for (int i = number_of_nodes; i > 0; i--)
{
if (explore[i] == 0)
{
dfs_1(adjacency_matrix, i);
}
}
int rev_matrix[][] = new int[number_of_nodes + 1][number_of_nodes + ... |
115945ff-60b0-43ad-9125-7850273833ee | 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... |
4fccd509-ad05-4ec5-bba6-b83586b371ca | 2 | public static JSONObject readFile(String path) throws FileNotFoundException {
File f = new File(path);
if (!f.exists())
throw new FileNotFoundException();
try {
String jString = fileToString(path);
JSONObject obj = (JSONObject) JSONValue.parse(jString);
return obj;
} catch (IOException e) {
e.pr... |
d78858a5-2246-4239-90bd-3ed1b80c9788 | 1 | public List<Item> getAllItems(){
try{
org.hibernate.Query query = session.createQuery("from Item");
@SuppressWarnings("unchecked")
ArrayList<Item> items = (ArrayList<Item>) query.list();
return items;
}
catch(HibernateException e){
Main.getFrame().showError("A hozzáadás sikertelen volt: "+e.getMessage(... |
2ff2cc2c-5de9-4180-b8f1-5cc5da16b305 | 2 | public SnakeServerMessage snakeServerMessageDecode(String mess)
throws JSONException {
JSONObject obj = new JSONObject(mess);
double[] p;
JSONArray JArr = obj.getJSONArray("PlayerArray");
SnakeServerMessage SSM = new SnakeServerMessage(JArr.length());
for (int i = 0; i < JArr.length(); i++) {
p = new d... |
0c950cf1-e323-4b2e-8bfe-ccac58a46a2b | 4 | public void createPawnLabelsAdd(JPanel Square[][])
{
arraybPawns= new ArrayList<JLabel>();
arraywPawns= new ArrayList<JLabel>();
//I create the labels for every the pawns
for (int i = 0; i < 8; i++)
{
arraybPawns.add(new JLabel( new ImageIcon("pawn.png") ));
}
for (int i = 0; i ... |
37d3ceea-ed7c-4459-8fa9-f7fce2ee5624 | 3 | public void originalCentrosLocal(double paramDistancia,double paramRadio)
{
Iterator elemFuente;
Elemento entrada,salida;
Iterator elemDestino = destino.listaElementos();
double sumaDistancias,sumaValores,distancia,ponderacion;
fuente.generaCentros();
... |
93028066-1ee6-48bd-baf7-72eb21b65894 | 3 | @Override
public void caseAConstantesDeclaracao(AConstantesDeclaracao node)
{
inAConstantesDeclaracao(node);
if(node.getConst() != null)
{
node.getConst().apply(this);
}
if(node.getVar() != null)
{
node.getVar().apply(this);
}
... |
39894e87-2ea4-4ff5-a2a3-7fe03ad4e676 | 3 | @Override
public void keyPressed(KeyEvent evt) {
if (evt.getKeyCode() == KeyEvent.VK_SPACE) {
_listener.actionSPACE();
}
if (evt.getKeyCode() == KeyEvent.VK_ENTER) {
_listener.actionENTER();
}
if (evt.getKeyCode() == KeyEvent.VK_ESCAPE){
_listener.actionESC();
}
} |
8f779356-75b9-4eeb-87ce-b25802522c8a | 2 | @Override
public void playRoadBuildingCard(IPresenter presenter, EdgeLocation spot1,
EdgeLocation spot2) {
MoveResponse response=presenter.getProxy().playRoadBuildingCard(presenter.getPlayerInfo().getIndex(), spot1, spot2, presenter.getCookie());
if(response != null && response.isSuccessful()) {
presenter... |
b09f5327-854c-4099-9620-9f4638c8b333 | 9 | private long parseWithMultiplier(String numberStr) {
char c = numberStr.charAt(numberStr.length() - 1);
final long mult;
if (Character.isDigit(c)) {
mult = 1;
} else {
switch (c) {
case 'k':
case 'K':
mult = 1L << 10;
break;
case 'm':
cas... |
27b6b46f-d08c-43f7-9251-8c8ebcfd4945 | 6 | public void newGameRender(GameContainer gamec, Graphics g) {
g.setColor(Color.black);
g.fillRect(0, 0, WIDTH, HEIGHT);
g.setColor(Color.white);
GC.getSisyphus().draw(0, 0, GC.getSisyphus().getWidth() * .6667f,
GC.getSisyphus().getHeight() * 0.5555f);
if (toggleCursor) {
g.drawString(">> " + command... |
b54e8ddb-c058-4036-98ca-9eef4bdbfd7f | 6 | public void build(SegmentTermEnum indexEnum, int indexDivisor, int tiiFileLength) throws IOException {
if (instantOn.load(this,directory,segment)) {
return;
}
int indexSize = 1 + ((int) indexEnum.size - 1) / indexDivisor;
indexToTerms = new int[indexSize];
// this is only an inital size, it will be GCed on... |
d5984a03-d8ab-4cd9-aa6b-8da53f05f1d6 | 3 | public boolean isFound(T searchData){
ListNode<T> actualNode = head;
while ((actualNode != null) && !searchData.equals(actualNode.getData())) {
actualNode = actualNode.getNext();
}
if (actualNode == null) {
return false;
} else {
return true;
}
} |
6962e746-55d9-4546-9965-cfccd870182e | 5 | public boolean fromTrade(int itemID, int fromSlot, int amount) {
if (amount > 0 && (itemID + 1) == playerTItems[fromSlot]) {
if (amount > playerTItemsN[fromSlot]) {
amount = playerTItemsN[fromSlot];
}
addItem((playerTItems[fromSlot] - 1), amount);
if (amount == playerTItemsN[fromSlot]) {
playerTIt... |
0eb19375-b919-49d5-bf40-044e847f4a21 | 3 | public boolean isEvil(){
switch(this){
case LAWFUL_EVIL:
case NEUTRAL_EVIL:
case CHAOTIC_EVIL:
return true;
default:
return false;
}
} |
c634caa7-0711-4108-bc2a-e414dd9b23a1 | 0 | protected final Logger getLogger() {
return LoggerFactory.getLogger(this.getClass());
} |
8a419d1c-f414-4709-a4a5-c117c885ee17 | 3 | public void run(double duration) {
double endtime = _currentTime + duration;
while ((!empty()) && (_head.next.waketime <= endtime)) {
// if ((_head.next.waketime - _currentTime) <= 1e-05) {
// super.setChanged();
// super.notifyObservers();
// }
if ((_currentTime - _lastUpdate) > (MP... |
eb3afb0b-73bd-4e84-9b41-8f81f8e3973a | 2 | public void allowSort(boolean allow) {
if (allow != mAllowSort) {
mAllowSort = allow;
if (!mAllowSort) {
mSortSequence = -1;
}
}
} |
8c30f192-8293-44d2-83cf-857d940ed478 | 6 | public void save(String site, String login, String mdp) {
dataSaved = false;
identifiant = new Identifiant();
if (site.isEmpty()) {
site = "NA";
}
if (login.isEmpty()) {
login = "NA";
}
if (mdp.isEmpty() || mdp == null) {
mdp = "NA";
}
byte[] loginEncrypted = this.encrypt(login, clef);
... |
63f85661-0334-4d65-a5c3-9ff82182f45d | 8 | private void refresh(boolean repopulateCombo) {
if (combo == null || combo.isDisposed())
return;
// $TODO GTK workaround
try {
if (zoomManager == null) {
combo.setEnabled(false);
combo.setText(""); //$NON-NLS-1$
} else {
if (repopulateCombo)
combo.setItems(getZoomManager().getZoomLevelsA... |
f8a3ec07-7fea-458d-9497-97bfca267fb7 | 3 | SoundEffect(String soundFileName) {
try {
// Use URL (instead of File) to read from disk and JAR.
URL url = this.getClass().getClassLoader().getResource(soundFileName);
// Set up an audio input stream piped from the sound file.
AudioInputStream audioInputStream = AudioSystem.ge... |
31464b63-d684-4615-bb2e-c426515a8bee | 3 | public boolean check(Hand hand) {
List<Card> cards = new ArrayList<Card>(hand.getCards());
Collections.sort(cards);
Map<Suit, Integer> suits = new TreeMap<Suit, Integer>();
Map<Rank, Integer> ranks = new TreeMap<Rank, Integer>();
for (Card c : cards) {
if (!suits.containsKey(c.getSuit()))
suits.put(c.g... |
93d474e6-43d3-4c15-88e4-eae99b0a27c1 | 2 | private int truncX (int x) {
if (x < 3) {
x = 3;
}
if ((x + slider.getWidth() + 3) > INDICATOR_WIDTH) {
x = INDICATOR_WIDTH - slider.getWidth() - 3;
}
return x;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.