method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
3a4033d8-7669-4668-b979-a2b05e52be4c | 2 | public static SanitaryFacilityEnumeration fromValue(String v) {
for (SanitaryFacilityEnumeration c: SanitaryFacilityEnumeration.values()) {
if (c.value.equals(v)) {
return c;
}
}
throw new IllegalArgumentException(v);
} |
9251f858-cbfa-4496-8d4d-9415af2d7fb3 | 6 | @SuppressWarnings("unchecked")
@EventHandler
public void onSignEdit(SignChangeEvent event){
for(String line:event.getLines()){
for(String word:simplify(ChatColor.stripColor(line)).split("[,./:;-`~()\\[\\]{}+ ]"))
if(wordList.fuzzilyContains(word)){
swearReport(event.getPlayer().getName());
event.ge... |
435fb525-fc32-4cd9-b67a-34525acffa1a | 0 | private static void runEntityProcessorThread() {
Thread rawEntityConsumerThread = new Thread(new RawEntityConsumer());
rawEntityConsumerThread.start();
} |
33bddea3-3131-4bd2-b282-3bc081122bc1 | 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... |
79169bb0-dfe5-461e-b837-d26457151295 | 0 | public String getEmployeeId() {
return employeeId;
} |
7b107dfd-8f46-4795-b0eb-c4bc4f5880e3 | 0 | public ListGroup(TKey key)
{
this._key = key;
} |
5978f133-24ff-4566-a9f9-e397192063d3 | 3 | public static void toggleExpansion(Node currentNode, JoeTree tree, OutlineLayoutManager layout, boolean shiftDown) {
JoeNodeList nodeList = tree.getSelectedNodes();
for (int i = 0, limit = nodeList.size(); i < limit; i++) {
Node node = nodeList.get(i);
if (node.isExpanded()) {
node.setExpanded(false, !shi... |
9ba48a46-83bf-4fff-9559-80983fcabeee | 2 | public void processEntity(Entity entity, long elapsedTime) {
Shoot shootComponent = entity.getComponent(Shoot.class);
// Decrease their delayed shooting time so that they may be able to
// fire again
shootComponent.currentWaitingTime -= elapsedTime;
if (shootComponent.shootRequired
&& shootComponent.curre... |
56f02ee1-cf6e-4a5a-bacf-eead05dc23ef | 1 | public static boolean isWin7() {
if (os == null) {
getOS();
}
return (os.contains(WIN7_REGEX));
} |
658a95d0-ed31-4e28-a142-52ec32786002 | 0 | public int GetNextbusStop()
{
//get the next bus stop to visit
return nextBusStop;
} |
4de2ef4f-6d96-4299-b626-3e3f69af8ec2 | 4 | @Override
public void applyDisguise(Collection<Player> players) {
UUID uid = new UUIDRetriever(name).getUUID();
GameProfile gp = new GameProfile(uid == null ? UUID.randomUUID() : uid,
name);
UUIDRetriever.setSkin(gp);
EntityPlayer playerEntity = ((CraftPlayer) getPlayer()).getHandle();
EntityPlayer ep = ... |
ba3a7bfb-0df7-4353-8e7f-e6ab13da038c | 8 | public static boolean kick(String[] args, CommandSender s){
//Various checks
if(Util.isBannedFromGuilds(s) == true){
//Checking if they are banned from the guilds system
s.sendMessage(ChatColor.RED + "You are currently banned from interacting with the Guilds system. Talk to your server admin if you believe th... |
5da3e3c2-005a-4eda-90b4-38dac3e1f49a | 7 | private void updateChanges()
{
Map<Integer, BoxState> changes = game.getLastChanges();
for (Map.Entry<Integer, BoxState> entry : changes.entrySet()) {
int index = entry.getKey();
BoxState state = entry.getValue();
switch (state) {
case SAFE:
... |
b165e761-922f-4eff-81c6-1a1002ce09b6 | 4 | public void getNewAbility() {
// TODO Auto-generated method stub
if(this.getLevel() == 2)
{
//lightning strike
//deals more damage the less hp the opponent has
addAbility(new Lightning());
}
if(this.getLevel() == 4)
{
//mass fireball
//aoe hits everything
addAbility(new MassFireball());
... |
73a7f734-62fd-4eb4-990d-48a7b7d72a38 | 9 | private Object callMethod(Method method, String o, Object arg,
List<Object> initParametersProcessed) throws TemplateException {
if (!((Class<?>) method.getDeclaringClass()).isAssignableFrom(((Class<?>) arg.getClass()))) {
throw new TemplateException("Unable to render '\... |
d33391d4-fff3-4921-a1dc-e87dc75c0ff4 | 6 | public static Point calculateIntersectingPoint(Line lineOne, Line lineTwo) {
double a1 = lineOne.getA();
double b1 = lineOne.getB();
double c1 = lineOne.getC();
double a2 = lineTwo.getA();
double b2 = lineTwo.getB();
double c2 = lineTwo.getC();
// two lines are p... |
279377e9-53f1-49de-abf2-e526a8b8827b | 3 | private void CboxOuderActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CboxOuderActionPerformed
CboxGezin.removeAllItems();
if (!CboxOuder.getSelectedItem().equals("Onbekend")) {
Persoon p = (Persoon) CboxOuder.getSelectedItem();
if (p != null) {
... |
35d9f78d-6558-4798-906b-a31292226774 | 9 | protected boolean checkForCollision(int[][] tempBlock, int tempX, int tempY) {
clearMovingBlocks(tempBlock, 1);
for (int i = 0; i < tempBlock.length; ++i) {
for (int j = 0; j < tempBlock[i].length; ++j) {
//Testing if the block is in the bounds of gamestatus
i... |
8afae5d1-c0df-43f0-a142-a33910a2e576 | 8 | public String [] getOptions() {
String [] options = new String [9];
int current = 0;
options[current++] = "-X"; options[current++] = "" + getCrossVal();
if (m_evaluationMeasure != EVAL_DEFAULT) {
options[current++] = "-E";
switch (m_evaluationMeasure) {
case EVAL_ACCURACY:
options[... |
d9e8e1f1-1f76-4127-89a2-f05355db0a2d | 1 | public void initInterfaceJeu(){
//HIGHSCORE
bestScore = new BPBestScore();
//STATISTIQUE
statistique = new BPStatistiques();
// JEU
jeu = new PJeuTetris(10,20,new Dimension((int) (this.getWidth()*0.6), (int) (this.getHeight()*0.925)));
if (couperSon.isS... |
31bf9d0f-c1d7-42bb-b02e-e9c05e05ab6a | 7 | @Test
public void execute() {
LOGGER.info("Starting test execute method...");
AreaLineManager gardenLineManager = new AreaLineManager();
gardenLineManager.initCommands();
String result;
// 1. null input
LOGGER.debug("testing null input...");
try {
result = gardenLineManager.execute(null);
assertEq... |
962d5590-97d5-427c-b7e1-50d436a045da | 6 | public void mReleased(MouseEvent e)
{
if(rdown)
{
PermClass nodeToAdd = getClassUnderPoint(e.getX(), e.getY());
if(nodeToAdd != null)
{
boolean shouldAdd = true;
if(nodeToAdd == selectedOne)
{
shouldAdd = false;
}
for(PermClass is : selectedOne.inheritsFrom)
{
... |
0cac21eb-7785-49b8-9081-f416d2209008 | 5 | @Override
public String analyze_round( List<Submission> list ) {
if ( list.isEmpty() ) return null;
List<Submission> trumps = is_suit(list, trump());
if (trumps.size() == 1) {
return trumps.get(0).who;
}
if ( !trumps.isEmpty() ) {
return is_rankier(tr... |
97d07c05-a27f-4429-9b19-5391a4a75b56 | 1 | public final void need(int count) throws VerifyException {
if (stackHeight < count)
throw new VerifyException("stack underflow");
} |
c8e6148a-d6d8-4f84-a290-bd9334febfac | 5 | public void getNextMovesBack(List<State> nextStates) {
// for each box. Chech which boxes we can reach
// box : The current box we are looking at
for (Position box : boxes) {
// for each empty position adjucent to this box
// adjucent : the current adjucent position to t... |
7db6c64f-de5e-4267-86b8-13b75523627e | 4 | private void analyzeUtility() {
if (getKingLocation( playerToMove.equals(KrakenColor.WHITE_PLAYER)? KrakenColor.BLACK_ITEM:KrakenColor.WHITE_ITEM) == null || actions(playerToMove.toLowerCase()).size()<1)
utility = playerToMove.equals("W")? 1:0;
} |
5bffc811-1431-4ab7-ab1d-3b02ecd1fbdf | 7 | public double weightedStandarError_as_Complex_ConjugateCalcn() {
boolean hold = Stat.nFactorOptionS;
if (nFactorReset) {
if (nFactorOptionI) {
Stat.nFactorOptionS = true;
} else {
Stat.nFactorOptionS = false;
}
}
boolean hold2 = Stat.nEffOptionS;
if (nEffReset) {
if (nEffOptionI) {
St... |
1ae5a32c-e723-41e7-9d30-9ae05b4c3164 | 0 | public Point getInitialP() {
return initialP;
} |
69cc4328-63e6-4b29-8df2-a3b8a75b824d | 5 | public boolean checkVictory() {
int yourLocation = yourPaddle.getPosition()[0];
int yourSize = Paddle.getSize()[0];
int[] ballLocation = ball.getPosition();
int radius = Ball.getSize();
if (ballLocation[1] < 300) {
if (ballLocation[0] > 155 + radius && ballLocation[0] < 445 - radius) {
if (ballLo... |
6139743c-e64d-4984-8af7-3a97f863dcd5 | 6 | public boolean equals(Object o) {
if(o instanceof IMessage && o!=null) {
IMessage c=(IMessage)o;
if(c.taille()==this.taille()) {
boolean trouve=false;
int i=0;
while(i<this.taille() && !trouve) {
if(c.getChar(i)!=this.getChar(i)) {
trouve=true;
}
i++;
}
return !trouve;
... |
6cf2228b-19ce-4fad-80d8-6432a6c14d3d | 5 | public int removeDuplicates(int[] A) {
if(A ==null || A.length ==0)
return 0;
int index =1;
boolean flag = true;
for (int i = 0;i < A.length-1 ;i++){
if(A[i] != A[i+1]){
flag = true;
A[index++] = A[i+1];
}else if(flag){
... |
7fe967a6-7806-4b89-8193-c2dd37ab6ba3 | 2 | public static Double caculate(Model m, List<String> observe) {
List<Double> initial = m.pi;
List<Double> temp = new ArrayList<Double>();
Double result = 1d;
for (String s : observe) {
int index = m.V.indexOf(s);
result *= Matrix.multiply(initial, m.B.get(index));... |
c264cf01-f138-429b-a1a6-94c639d6f794 | 3 | public static void main(String[] args) {
long start = System.nanoTime();
int totalSum = 0;
for (Integer i = 2; i <= 194979; i++) {
String intStr = i.toString();
int strLen = intStr.length();
int sum = 0;
for (int k = 0; k < strLen; k++) {
int num = Character.getNumericValue(intStr.charAt(k));
... |
5139a826-a2fd-43c2-8fb1-67a1a298eca5 | 8 | @Override
public Object getValueAt(int row, int col) {
int round = currentRound + ( row / teamsPerTable );
int table = ( col - 1 ) / 2;
if(col == 0) {
if(row == 0)
return "Playing:";
if(row == teamsPerTable)
return "Next:";
}
else if((col-1) % 2 == 0) {
if(row == 0)
return tableNames[(c... |
97aa2c91-f8b1-495e-8762-11f3551d1df4 | 4 | private TreeNode rotateLeft(TreeNode rotatingNode) {
TreeNode rotatedTreeRootNode = rotatingNode.right;
rotatedTreeRootNode.parent = rotatingNode.parent;
rotatingNode.right = rotatedTreeRootNode.left;
if (rotatingNode.right != null) {
rotatingNode.right.parent = rotatingNode;
}
rotatedTreeRootNode.le... |
a5bdc68f-5cd5-4ce5-bac8-e377490c9cbc | 0 | public final void show() {
StackPane parentRoot = (StackPane) ((Stage) stage.getOwner())
.getScene().getRoot();
parentRoot.getChildren().add(mask);
stage.show();
} |
77fd04e6-e3cc-486d-8f35-4993844c1c7e | 5 | public static HardwareAddress getHardwareAddressByString(String macStr) {
if (macStr == null) {
throw new NullPointerException("macStr is null");
}
String[] macAdrItems = macStr.split(":");
if (macAdrItems.length != 6) {
throw new IllegalArgumentException("macStr["+macStr+"] has not 6 items");
}
byte[... |
0e9b4de4-3ec9-40bd-9445-29bafa22fe74 | 9 | public void install() {
try {
if (plugin.getConfig().getBoolean("internet")) {
try {
String path = plugin.getDataFolder().getParent();
if (download(path)) {
plugin.getLoggerUtility().log("Downloaded new Version!", Logger... |
cca61f6c-ae72-4c71-958b-9a1d4ae36f5f | 6 | private void scanColorUnit(JPEGBitInputStream bis, Set<Integer> color_ids, Map<Integer, Integer> dc_base) throws MarkAppearException, IOException {
// 对颜色空间进行扫描
for (int color_id : color_ids) {
JPEGImage.JPEGLayer layer = mImg.getLayer(color_id);
// 对每一种颜色的采样值进行扫... |
e23c8f6f-2567-4243-82d5-79933e670331 | 0 | public Items getLast() {
return last;
} |
f426f189-571b-4fcd-a6a5-1c817ca9ee6b | 6 | public void restoreStatus(){
// EDebug.print("I am mucking with that data structure.");
if (myDeck.size() == 0) return;
Automaton p = null;
while (myDeck.size() > 0 && (p = myDeck.pop()).hashCode() == myMaster.hashCode());
// EDebug.print("Master's hash i... |
d74ba192-5a57-447c-805a-43df7fa79d03 | 8 | private boolean equals(
final Data item, final InnerDataSubscription subscription, final SystemObject transactionObject) {
final SystemObject requiredObjectType = item.getReferenceValue("ObjektTyp").getSystemObject();
if(requiredObjectType != null && !subscription.getObject().getType().equals(requiredObjectType)... |
872bf840-6262-4e30-af1f-134d232db779 | 8 | static LinkedHashSet<EXECUTION_MODE> getDefaultExecutionModes() {
LinkedHashSet<EXECUTION_MODE> defaultExecutionModes = new LinkedHashSet<EXECUTION_MODE>();
if (OpenCLLoader.isOpenCLAvailable()) {
defaultExecutionModes.add(GPU);
defaultExecutionModes.add(JTP);
} else ... |
bc1524e8-9b06-4095-a8af-561a364f15c6 | 7 | public void stopGather(Player p) {
if (registry.getGameController().multiplayerMode != registry.getGameController().multiplayerMode.CLIENT) {
Resource resource = null;
try {
for (String key : resources.keySet()) {
resource = (Resource) resources.get(ke... |
c163261d-8dbd-4f9a-a0ed-a1f84b323470 | 8 | public int compare(JAFieldDescription field1, JAFieldDescription field2) {
Integer order1 = (field1.hasView()) ? (field1.getView().getOrder()) : -1;
Integer order2 = (field2.hasView()) ? (field2.getView().getOrder()) : -1;
if ((order1 >= 0) && (order2 < 0)) {
return 1;
}
if ((order2 >= -1) && (order1 < ... |
ac54b696-d36d-4307-83b2-96191fe3ee14 | 3 | protected void checkFlush(Texture sprite) {
if (sprite == null)
throw new NullPointerException("null texture");
// we need to bind a different texture/type. this is
// for convenience; ideally the user should order
// their rendering wisely to minimize texture binds
... |
75e7ea76-d7df-4fae-89cb-5cc1c9519697 | 2 | @Override
public String infix_toString(){
String representation = root.name;
if(children.length != 0){
representation += "[";
for(int index = 0; index < children.length; index++){
representation += children[index].toString();
}
representation += "]";
}
return representation;
} |
9e1b4e3a-8e5a-493e-9c1d-3ad0a6e8ccce | 7 | public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String line = "";
StringBuilder out = new StringBuilder();
while ((line = in.readLine()) != null && line.length() != 0) {
int times = Integer.parseInt(line.trim());
for (in... |
9751767f-4ad0-43c4-a7b5-8a9f4da1e40b | 0 | public void setId(int id) {
this.id = id;
} |
0c691f59-22df-4de1-8e68-5761649eff76 | 3 | public String translate(final String key) {
final String pattern = this.base.getString(key);
if (pattern.equals("")) {
this.plugin.getLogger().log(Level.FINEST, "String value not found for {0} in {1}", new Object[] { key, ( this.base.getCurrentPath().equals("") ? "(root)" : this.base.getCurr... |
56c90f0e-462f-4325-b92a-12870c60c61e | 0 | @Test
@TestLink(internalId = 5)
public void testSuccessInternal2() {
assertTrue(true);
} |
74a4aa87-e4e2-440a-8c06-95c93b3d5f7e | 6 | public void doAction()
{
// Verificar se não existe toca
if( isTocaNull() )
{
// Incrementar número de vezes em que se comeu toca permanente e correr método de adição
if( getEngine().getTocaPermanente().check() )
{
numTocaPermanenteComida++;
add();
}
return;
}
// Verificar se não com... |
2b23c4ef-978f-43a9-86aa-6efe44067ddb | 0 | public String getSpNum() {
return spNum;
} |
89d096d8-7544-4f60-8b42-cb1a0e7a9582 | 1 | public void setLength(double value) {
if (value <= 0) {
throw new IllegalArgumentException(
"Illegal length, must be positive");
} else {
length = value;
weight = calculateTotalWeight();
}
} |
4db2d36c-b985-46d0-bc4f-cf48264f6f77 | 5 | @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Specialty)) {
return false;
}
Specialty other = (Specialty) object;
if ((this.id == null && other.id != null) |... |
6576de2d-8529-46b7-95cf-4d70defd419c | 3 | @Override
public boolean waitForCardPresent(long timeout) throws CardException {
long sleeptime = timeout / POLLING_INTERVAL;
for (short i = 0; i < POLLING_INTERVAL; i++) {
if (isCardPresent())
return true;
try {
Thread.sleep(sleeptime);
} catch (InterruptedException e) {
break;
}
}
ret... |
5abfad84-3232-422d-b9bf-66d7c932e4a1 | 5 | public boolean caricaLista() {
try {
f1 = new FileReader("parole.txt");
fIN = new BufferedReader(f1);
try {
int l = 0;
while (fIN.readLine() != null) {
l++;
}
... |
4534f693-38cd-4aa7-9cd9-4e7d3bd24778 | 1 | @Override
public int open(JoeTree tree, DocumentInfo docInfo, InputStream stream) {
FileFormatManager manager = Outliner.fileFormatManager;
String extension = getExtension(PropertyContainerUtil.getPropertyAsString(docInfo, DocumentInfo.KEY_PATH));
OpenFileFormat format = null;
String format_name = null;
... |
0b27e546-256e-41cf-b21a-4a87fe4a2e54 | 0 | public static void main(String[] args) {
// Working with Method Parameters and Return Types
System.out.println("string");
String name = "Madalin";
int nameLength = name.length();
System.out.println(nameLength);
} |
b445e965-0114-4383-9a5e-4fc5886f8a88 | 5 | @Override
public boolean hit(Ray ray, ShadeRec sr, FloatRef tmin) {
float t = subtract(p0, ray.getOrigin()).dot(normal) / ray.getDirection().dot(normal);
if (t <= K_EPSILON)
return false;
Vector3 p = ray.pointAt(t);
Vector3 d = subtract(p, p0);
double ddota = d... |
383d09d5-5ef7-4930-9499-a882ee0af197 | 1 | private void buildHeap(int index) {// using postOrder
if (index + 1 > size)
return;
buildHeap(2 * index + 1);
buildHeap(2 * index + 2);
trickleDown(index);
} |
601d9ffd-af59-4798-a8c1-c5abc447701c | 1 | private void animateNextFrame() {
// Animate next frame on buffer
Graphics2D g = (Graphics2D) buffer.getDrawGraphics();
drawFrame(g);
// Display the buffer
if (!buffer.contentsLost()) {
buffer.show();
}
g.dispose();
// Repainting solves the problem of the applet not updating properly
// on the Red ... |
f8064f73-0bee-4d65-a495-dd4340fe62d6 | 1 | public void doCSVHeaderAndTrailer() {
try {
final String mapping = ConsoleMenu.getString("Mapping ", CSVHeaderAndTrailer.getDefaultMapping());
final String data = ConsoleMenu.getString("Data ", CSVHeaderAndTrailer.getDefaultDataFile());
CSVHeaderAndTrailer.call(mapping, dat... |
0be09dbd-d0b3-4f78-b0bb-85e9b63494f2 | 1 | public final String getDisplay() {
String data;
data = "Welcome to Kohl's. Expect Great Things \n";
data += "------------------------------------------- \n";
data += "Customer Name: " + customer.getCustName() + "\n";
data += "Date of Purchase: " + formattedDate + "\n";
da... |
9e7b1edb-96c6-4b03-8636-536362577859 | 6 | public static Maze parseMaze(String filename) throws IOException{
/* Parse to lines of strings */
List<String> mazeText = new ArrayList<String>();
BufferedReader br = new BufferedReader(new FileReader(filename));
String line;
int mazeHeight = 0;
int mazeWidth = 0;
while ((line = br.readLine()) != null) {
... |
5006cf6b-a0cb-4158-b2d4-acf6d19f6b0a | 5 | public void testAllPairs(File file){
try {
Scanner scan = new Scanner(file);
while(scan.hasNextLine()){
String[] line = scan.nextLine().split("\t");
if(line.length != 2)
continue;
int ip = stringToIP(line[0].trim());
String host = line[1].trim();
if(!testPair(ip, host)){
System.out.prin... |
69ae9dd6-ca5b-4802-913b-4e4ead893990 | 8 | public void work(Contract... contracts) {
// do the most risky jobs first
int maxRisk = Integer.MIN_VALUE;
int riskIndex = 0;
boolean theresJobToBeDone = true;
while (theresJobToBeDone) {
for (int i = 0; i < contracts.length; i++) {
Contract contract = contrac... |
d4a58e72-e599-4202-92f2-bf1aadaec834 | 8 | public static void getFilesHashAndUpdate(EcProrgressBar bar,EcButton btn,EcServerButton aquilla) throws NoSuchAlgorithmException, IOException {
UpdateUtils.bar = bar;
UpdateUtils.btn = btn;
UpdateUtils.aquilla=aquilla;
aquilla.setEnabled(false);
btn.setEnabled(false);
upd... |
ea9b7fd5-390e-421c-b1da-3041c3c6a414 | 4 | private static void generateRandomTree(World world){
BlockLog b = null;
TileMap tm = world.tileMap;
for(int numTrees = 0; numTrees < 4; numTrees++){
int x = new Random().nextInt(tm.getXRows());
int y = new Random().nextInt(tm.getYRows());
for(int numLogs = 0; numLogs < 3; numLogs++){
if(y - numL... |
8e74a7c8-97f8-4435-8afe-75c56b633052 | 3 | public RegistrantList getRegistrantList(int aiMaxSize, String asLastModified) {
String lsParam = "";
if (aiMaxSize > 0) {
lsParam += "&max_size=" + Integer.toString(aiMaxSize);
}
if (UtilityMethods.isValidString(asLastModified)) {
lsParam += "&last_modified=" + as... |
b6a6f469-6c38-44aa-a69d-3f1f09a4f4df | 9 | static private boolean jj_3R_16() {
Token xsp;
xsp = jj_scanpos;
if (jj_scan_token(43)) {
jj_scanpos = xsp;
if (jj_scan_token(40)) {
jj_scanpos = xsp;
if (jj_scan_token(28)) {
jj_scanpos = xsp;
if (jj_scan_token(44)) {
jj_scanpos = xsp;
if (jj_scan_token(39)) {
jj_scanpos... |
08b59f83-4764-4ff3-aca4-04e1e6d687b7 | 7 | public static String GetDzienNoc() {
String dziennoc;
Calendar cal = Calendar.getInstance();
int s = cal.get(Calendar.HOUR_OF_DAY);
int p;
int dn;
dn = 0;
if (s>=19) {
p = 5;
dn = 0;
}
else {
... |
0f562104-95cb-48a8-903f-f885c58b581f | 8 | @Override
public int getAbilityFlagType(String strflag)
{
for (final String element : Ability.ACODE_DESCS)
{
if(element.equalsIgnoreCase(strflag))
return 1;
}
for (final String element : Ability.DOMAIN_DESCS)
{
if(element.equalsIgnoreCase(strflag))
return 2;
}
if(strflag.startsWith("!"))
... |
d3e35319-1da1-4b2d-b257-3fe5bba1a4bc | 0 | @Override
public String toString() {
return nom;
} |
33364233-e418-429d-bd84-427bba363d19 | 2 | private synchronized void containMouse(int x, int y){
Window w = sm.getFullScreenWindow();
if(robot != null && w.isShowing()){
finalPos.x = x;
finalPos.y = y;
SwingUtilities.convertPointToScreen(finalPos, w);
robot.mouseMove(x, y);
}
} |
43af33ae-7578-4afb-9c7e-59e633c8c04b | 7 | public void setProgress(String oid, String progress)
{
Objective o = q.getObjective(oid);
if(o == null)
throw new IllegalArgumentException("Quest \"" + q.getName() + "\" has no such objective: " + oid);
if(!o.getType().isValid(progress))
throw new IllegalArgumentException("progress is not valid for type " ... |
f7b831d3-f6b8-48fe-80cf-e1e3d31047c9 | 5 | private static Pair<Integer, Integer> findNest(String value, int target, boolean fromEnd){
int lastFound = Integer.MIN_VALUE;
int nest = 0;
for(int i = 0; i < value.length(); i++){
int search = fromEnd ? value.length() - 1 - i : i;
if(value.charAt(search) == '('){
nest++;
}
else if(value.charAt(se... |
cb115931-0147-436e-b0d9-3a886aeedd35 | 0 | public JCellule[][] getGrid() {
return cellules;
} |
81995daf-9c39-4566-8ae8-5387d3983a2e | 9 | @Override
public void rout(NetworkPacket networkPacket) throws IOException {
if (networkPacket.isFlagSet(NetworkPacket.ARP)) {
if (!networkPacket.getSourceAddress().equals(networkInterface.getLocalHost())) {
networkInterface.process(networkPacket);
if (networkPacket.getHopcount() > 0) {
networkP... |
97907ca5-18f1-49d8-8020-bb9003d87624 | 1 | private void preOrderRec(Position<T> node) throws InvalidPositionException {
if (node != null) {
BTPosition<T> BTnode = checkPosition(node);
System.out.print(node.element() + " ");
preOrderRec(BTnode.getLeft());
preOrderRec(BTnode.getRight());
}
} |
779e677d-f1c7-4a23-a825-8e3461eb80e4 | 1 | @Override
public int attack(double agility, double luck) {
if(random.nextInt(100) < luck)
{
System.out.println("I just did the holy cross attack!");
return random.nextInt((int) agility) * 3;
}
return 0;
} |
c640d011-4112-4681-8c3e-70dba112ce21 | 9 | public boolean isInterleave(String s1, String s2, String s3) {
int m = s1.length();
int n = s2.length();
if(m + n != s3.length()) return false;
//dp[i][j]: s1[0...i-1],和s2[0...j-1]可以交错匹配s3的最长长度
int dp[][] = new int[m+1][n+1];
dp[0][0] = 0;
//初始化第一列,即只用s1
... |
e42b38d9-4a50-43a2-975e-7d65d572181c | 5 | public void loadConfig(String config){
int configlength = config.length();
for (int i = 0; i < 369; i++){
int[] xy = indexToXY(i);
int x = xy[0];
int y = xy[1];
String cellValue = "";
if (i < configlength){
char configValue = config.cha... |
3280c83a-fa9e-4bc3-a6a6-3658fde4be9d | 2 | private int validateSkill(String skillName, MainMenuHeroSlot temp) {
for(int p = 0; p < temp.getcharacter().getSkillNames().length; p++) {
if(temp.getcharacter().getSkillNames()[p].getDesc().equalsIgnoreCase(skillName))
return p;
} // End for
return -1;
} |
73655b02-2e54-4bf7-a16f-72390cc638dc | 6 | @EventHandler
public void onPlayerMove(PlayerMoveEvent event) throws IOException {
Player player = event.getPlayer();
String playerName = player.getName();
if (!statusData.containsKey(playerName)) {
statusData.put(playerName, false);
}
Block block = player.getWorl... |
c193b2a8-0a63-4161-9d0b-820586862524 | 3 | private mxCell addNode(mxGraph graph, Object parent, mxGraphMlNode node)
{
mxCell v1;
String id = node.getNodeId();
mxGraphMlData data = dataNodeKey(node);
if (data != null && data.getDataShapeNode() != null)
{
Double x = Double.valueOf(data.getDataShapeNode().getDataX());
Double y = Double.valueOf(d... |
ee4fa081-f5ea-457a-b579-d41c9440bfcb | 8 | public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain)
throws IOException, ServletException {
if (response instanceof HttpServletResponse && request instanceof HttpServletRequest) {
HttpServletRequest httpRequest = (HttpServletRequest) request;
HttpServletR... |
f542f396-decc-433a-8c3d-497618bd3895 | 5 | public final ObjectProperty<ToggleGroup> toggleGroupProperty() {
if (null == toggleGroup) {
toggleGroup = new ObjectPropertyBase<ToggleGroup>() {
private ToggleGroup oldToggleGroup;
@Override protected void invalidated() {
final ToggleGroup toggleG... |
682c0fe3-9767-4505-95dc-ad780f9d0f71 | 2 | private static void setMapping(){
obsMapping = new SimpleBindings(); // creates an arrayList to contain the elements
InputStreamReader isReader= new InputStreamReader(Obstacle.class.getClassLoader().getResourceAsStream(pathAttr));
try (BufferedReader reader = new BufferedReader(isReader)) {
String line = re... |
f9a918be-80fa-4881-b3e9-450b10cf692d | 7 | public static Iterator sqlQuery(Proposition proposition, LogicObject database, Stella_Object arguments) {
RDBMS.checkForExternalDbUpdates(proposition, database);
{ MemoizationTable memoTable000 = null;
Cons memoizedEntry000 = null;
Stella_Object memoizedValue000 = null;
if (Stella.$MEMOIZATIO... |
60221a8f-d0d3-4996-ba1a-292478643d5c | 8 | public void recoverGoal(GoalDecider goalDecider) {
Unit.MoveType mt;
if (cost == CostDecider.ILLEGAL_MOVE
&& unit != null
&& current.getTile() != null
&& dst.getTile() != null
&& goalDecider != null
&& goalDecider.ch... |
fa21a081-27c1-42d8-983d-b217a64d3412 | 0 | public void disconnect(String reason){
client.getSession().disconnect(reason);
world = null;
} |
6d49fafd-063d-42fb-8c1a-717aa9d098a1 | 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... |
47e81cd5-d148-4f63-8fee-376c5cae9e4a | 5 | private String buildString() {
StringBuffer builder = new StringBuffer();
if (!StringUtils.isBlank(this.protocol)) {
builder.append(protocol);
builder.append("://");
}
if (!StringUtils.isBlank(this.host)) {
builder.append(this.host);
if (this.port > 0) {
builder.append(":");
builder.append(t... |
d0269108-088e-41af-9bd1-58e968df7e5c | 9 | public Object setMnemonic(String section,String tool,int key) {
int i;
for(i=0;i<_tb.size() && !_tb.get(i).name().equals(section);i++);
if (i==_tb.size()) {
return null;
} else {
toolbarSection sec=_tb.get(i);
for(i=0;i<sec.size() && (sec.get(i)==null ? true : (!sec.get(i).getName().equals(tool))) ;i++... |
5d6fe009-5d8d-4b00-8ec4-7f2415b13126 | 4 | private float mtmWeights(float rate){
/* Link rate | MTM Weights |
* ----------------------------------
* 11 | 1 |
* 5.5 | 1.44 |
* 2 | 3 |
* 1 | 5.45 |
* */
if(rate == 11f)
return 1f;
if(rate == 5.5f)
return 1.44f;
if(rate == 2f)
return 3f;
if(rate == 1f)
... |
8f0478ff-c14a-451e-ad3f-2fa7f0995765 | 5 | private void paintBalls(Graphics g)
{
for (Ball b: com.github.abalone.elements.Board.getInstance().getBalls() )
{
Coords ballCoords = b.getCoords();
Coords coords;
if ( this.reversed )
coords = new Coords(-ballCoords.getRow(), ballCoords.getCol());
else
... |
6522dfff-a958-4309-9b3f-a63b1bb29917 | 8 | public static void main(String[] args) {
String count = "unknown";
switch (args.length) {
case 0: count = "zero"; break;
case 1: count = "one"; break;
case 2: count = "two"; break;
}
switch (args.length) {
case 200000: count = "two... |
17028776-ff9c-4d35-b6a5-67e2313ef680 | 5 | public AdditionProblem(int aNew, int bNew){
a = aNew;
b = bNew;
String tempaBinary = Integer.toBinaryString(a);
String tempbBinary = Integer.toBinaryString(b);
checkValue = a+b;
diff = Math.abs(tempaBinary.length() - tempbBinary.length());
String temp = "";
for(int i = 0; i < diff; i++){
temp += "0... |
9bb5be8c-2d22-426a-a320-3a45809bb4b6 | 6 | @Override
public void run(){
System.out.println("RUN THREAD?");
if(this.type == 1)
runRequestGenerator();
else
runFailureGenerator();
if(this.type == 1)
try {
fis.append("Thread: "+ this.getId() + "\n");
fis.append("Clients: " + this.numberClients + "\n");
fis.append("Requests: " + this.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.