method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
aeac754d-1140-44d4-9369-a938881566c0 | 3 | @Override
public GameState[] allActions(GameState state, Card card, int time) {
GameState[] states = new GameState[1];
states[0] = state;
if(time == Time.DAY)
{
states[0] = beggarDayAll(new GameState(state), card);
}
else if(time == Time.DUSK)
{
PickTreasure temp = new PickTreasure();
states ... |
0f05216e-b0a4-4d10-bc6f-caa88ab1c68a | 0 | @Override
public int getMaxBackupCount() {
return maxBackupCount;
} |
a4686328-fd35-42ca-96e8-f439faca57c6 | 6 | private static LinkedList createNetworkSCFQ(BufferedReader buf,
double[] weight) throws Exception
{
if (buf == null) {
return null;
}
// create the Router objects first
LinkedList routerList = createRouter(buf, NetworkReader.RIP_ROUTER... |
2afd4551-3eb4-49b4-a7fa-27ae7a9ed8f0 | 3 | public int getNumberOfItems(char type) {
if (type == 'T') {
return numberOfTrees;
}
if (type == 'D') {
return numberOfDucks;
}
if (type == 'H') {
return numberOfHunters;
}
return -1;
} |
6a358e20-de78-4cc8-a9ab-3417a0d93a53 | 4 | private void btSalvarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btSalvarActionPerformed
// TODO add your handling code here:
Usuario u = new Usuario();
u.setLogin(txLogin.getText());
u.setSenha(txSenha.getText());
u.setTelefone(txTelefone.getText());
... |
2e8e2582-5c87-4f86-9627-0df97b35a911 | 1 | public static int[] toInt(Integer[] src) {
int[] result = new int[src.length];
for (int i = 0; i < result.length; i++) {
result[i] = src[i];
}
return result;
} |
74500feb-0907-4849-8e3f-0fb115b04f39 | 5 | public void printDomainMap(){
System.out.println("Printing domain maps"+ "\n");
for (Object attrName : attributeDomainMap.keySet()) {
String key = attrName.toString();
AttributeDomain domain = attributeDomainMap.get(key);
if(domain.getType() == AttributeDomain.DISCRETE){
System.out.println(key);
St... |
45146742-6ae8-4ca3-a5e0-2eaf1fb0e712 | 7 | DefaultMesoPopupMenu(MesoView v) {
super("Default");
view = v;
JMenuItem mi = new JMenuItem(view.getActionMap().get(MesoView.PASTE));
String s = MDView.getInternationalText("Paste");
if (s != null)
mi.setText(s);
add(mi);
addSeparator();
mi = new JMenuItem(view.getActionMap().get("Model Reader"));... |
159b5409-def4-4e31-b301-4523f6f53e73 | 2 | public void InsertaInicio (int ElemInser)
{
if (VaciaLista())
{
PrimerNodo = new NodosProcesos (ElemInser);
PrimerNodo.siguiente = PrimerNodo;
}
else
{
NodosProcesos Nuevo = new NodosProcesos(ElemInser);
NodosProcesos Aux = PrimerNodo;
while (Aux.siguiente !=PrimerNodo)
Aux = Aux.siguiente;
... |
85513b40-6f60-40e0-8534-66f641f0f65a | 6 | private static List<String> getPhylaHeaders(String firstLine) throws Exception
{
List<String> list = new ArrayList<String>();
String[] splits = firstLine.split("\t");
for( int x=0; x < splits.length; x++)
{
if( splits[x].startsWith("k__") && splits[x].indexOf("unclassified") ==-1 )
{
StringToke... |
38218988-320a-41f1-81c4-b3391d50e624 | 4 | private void pushMessage(String message, int type, String name) {
if (type == 0 && dialogID != -1) {
clickToContinueString = message;
super.clickType = 0;
}
if (chatboxInterfaceId == -1)
redrawChatbox = true;
for (int m = 99; m > 0; m--) {
chatTypes[m] = chatTypes[m - 1];
chatNames[m] = chatNames... |
767e8845-a69f-4868-b50c-6438c34bf102 | 3 | @Override
public void run() {
Thread.currentThread().setName("Unicast Monitor");
byte[] buffer = new byte[1024];
byte[] temp;
DatagramPacket dpack = new DatagramPacket(buffer, buffer.length);
SmallPacket dp;
while (true) {
try {
dSock.receive(dpack);
temp = new byte[dpack.getLength()];
... |
506c8a45-6e64-4d27-ab8f-f4b761a08dec | 3 | public static int toInt(Object object) {
if (object instanceof Number) {
return ((Number) object).intValue();
}
try {
return Integer.valueOf(object.toString());
} catch (NumberFormatException e) {
} catch (NullPointerException e) {
}
retur... |
ce473f21-1eb2-49cb-b26e-caa62647c014 | 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 Faculty)) {
return false;
}
Faculty other = (Faculty) object;
if ((this.idFaculty == null && other.idFaculty !=... |
aa5cfe8d-8a86-4d8a-b32e-cfc428bffa78 | 3 | protected void buildBirthdayBoxs() {
Calendar today = Calendar.getInstance();
today.setTime(new Date());
final int thisYear = today.get(Calendar.YEAR);
final int startYear = 1980;
Integer[] birthYears = new Integer[thisYear - startYear + 1];
int i;
for (i = startYear; i <= thisYear; ++i)
birthYears[th... |
d9478753-aa34-4bb6-9aca-5567f16367a8 | 7 | public static void StartCipherBlockChain(String cipherType, String numberBits, String pText) {
bitLength = Integer.parseInt(numberBits);
if (bitLength == null) {
System.out.println("Parse Number Bits Error!");
return;
}
byteArrays = new KeyAndIv(bitLength);
byteArrays.setRandomData();
if ... |
0569dee7-88fd-4f59-a078-64da33c3aca4 | 9 | public static void fastForward(boolean state) {
if(state) {
isFastForward = false;
Frame.gameScreen.spawnTime = (Frame.gameScreen.spawnTime * 2);
Frame.gameScreen.spawnFrame = (Frame.gameScreen.spawnFrame * 2);
Frame.gameScreen.nextWaveWaitTime = (Frame.gameScreen.nextWaveWaitTime * 2);
for(int y = 0; ... |
8eeeb2cf-a1f9-4ad2-8917-daef75fa4ae3 | 8 | public void optimizePhaseI() {
// the statement have to have an output line inorder to be able to sort
// input pins and refer to the output gate.
// NOTE that this assignment of outputLine may not be the final one
// (refer to the optimization phase II and circuit writing).
//
outputLine = Program.getL... |
48a76b95-3305-47b0-b885-00acc965bb2f | 2 | public void playFirework(World world, Location loc, FireworkEffect fe) throws Exception {
Firework fw = (Firework) world.spawn(loc, Firework.class);
Object nms_world = null;
Object nms_firework = null;
if (world_getHandle == null) {
world_getHandle = getMethod(world.getClass(), "getHandle");
firework_get... |
e8447ae1-7799-4d48-bc25-657e0ab719f0 | 4 | private void check_term_acks ()
{
if (terminating && processed_seqnum == sent_seqnum.get () &&
term_acks == 0) {
// Sanity check. There should be no active children at this point.
assert (owned.isEmpty ());
// The root object has nobody to confirm the te... |
f0a5c4c4-c30a-42cb-90b8-dd1340feb652 | 5 | public void run() {
while (true) {
try {
receiveInput();
} catch (InterruptedException e) {
System.out.println("Interrupt error at Player.run");
e.printStackTrace();
}
if(getMem().current != null) {
Pos pt = mh.vSub(getMem().current, getMem().home);
if((Math.abs(pt.x... |
4c065f3d-964a-430c-b7d3-958d4db45997 | 3 | boolean matchesPrefix(String prefix) {
// long t0 = System.nanoTime();
Boolean cached = cache.get(prefix);
if (cached != null) {
// System.out.println("prefix: " + (System.nanoTime() - t0));
return cached.booleanValue();
}
Set<String> tailSet = dictionary.... |
d5f1509b-d050-4521-96a2-74e327cf9eab | 0 | public PartA() {
System.out.println("PartA builded");
} |
90fff006-8d98-4946-a55a-cf70ba2dfa0f | 9 | private boolean expandCluster(DataObject dataObject) {
List seedList = database.epsilonRangeQuery(getEpsilon(), dataObject);
/** dataObject is NO coreObject */
if (seedList.size() < getMinPoints()) {
dataObject.setClusterLabel(DataObject.NOISE);
return false;
}
... |
e7b184b2-2904-49cb-830c-2a68b2c65e77 | 6 | @Override
public boolean accept(File file) {
boolean denied = false;
if(startsWith!=null) {
if(!file.getName().startsWith(startsWith)) {
denied = true;
}
}
if(endsWith!=null) {
if(!file.getName().endsWith(endsWith)) {
denied = true;
}
}
if(contains!=null) {
if(!file.getName().contain... |
a12613e4-9529-448d-939a-95122a100e9d | 6 | @SuppressWarnings({ "unchecked", "rawtypes" })
public static List<?> invoke(Signal signal, Object[] varargs)
{
List returnVal = new ArrayList();
if (USE_WORKER_THREADS && signal.isVoid() && linker.get(signal.getSignalName()).getRegisteredSlots().size() > 1)
{
for (Slot slot : linker.get(signal.getSignalName(... |
39519dcc-76ff-4a9a-adb1-ee9876693001 | 9 | public void SetParameter(int CameraIPIndex, CameraParameter par, float value) {
switch (par) {
case EXPOSURE:
this.SendParameter(CameraIPIndex, CameraParameter.EXPOSURE, value);
break;
case GAIN:
this.SendParameter(CameraIPIndex, CameraPara... |
73289e19-0700-41fd-9cec-c7151c776437 | 3 | public boolean hasStench(int x, int y)
{
if (!isValidPosition(x,y)) return false;
if (isUnknown(x,y)) return false;
if (w[x][y].contains(STENCH))
return true;
else
return false;
} |
cd608688-9098-4d70-828f-98470c2a388f | 5 | protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String email = request.getParameter("email");//takes in email
String passwordBeforeHash = request.getParameter("password");//takes in password
String nextUrl = "/Profile.jsp";//might need to cha... |
9a8bd651-8b6f-415b-a36d-2dc3505bc36d | 6 | @Override
public void mouseReleased(MouseEvent e) {
if (e.getButton() == MouseEvent.BUTTON1) {
left = false;
}
if (e.getButton() == MouseEvent.BUTTON3) {
((Component) e.getSource()).setCursor(Cursor.getDefaultCursor());
right = false;
}
if ... |
6b296b84-1a2c-40a6-9dfe-5c87b14af68b | 1 | public void add(Items item) {
// System.out.println("adding " + item.toString());
if (this.head == null) {
// The list is empty.
this.head = item;
this.last = item;
} else {
// The list is NOT empty.
this.last.setNext(item);
... |
d9ed11e8-e979-45d1-a09b-81d2bc44c68e | 4 | public boolean add(T arg0) {
if (validator == null || validator.test((arg0))) {
boolean result = delegate.add(arg0);
if (result) {
for (Listener<T> listener : addListeners) {
listener.objectAdded(arg0);
}
}
return result;
} else {
return false;
}
} |
4d8fdd4f-c388-40e8-abed-0d4b5fff526a | 9 | private void testAbstractMethods(ByteMatcher matcher) {
// test methods from abstract superclass
assertEquals("length is one", 1, matcher.length());
assertEquals("matcher for position 0 is this", matcher, matcher.getMatcherForPosition(0));
try {
matcher.getMatcherForPositio... |
b09d2d66-df90-47dd-abfc-0afe7cef29ab | 4 | public User signup(String mail, String name, String username, String password) {
if (!TextVerifier.verifyEmail(mail) || !TextVerifier.verifyName(username, policy) || !TextVerifier.verifyPassword(password, policy) || name.equals("")) return null;
User member = new User(mail, name, username, password, Rank.member);
... |
99be1b43-53ef-43ca-bcb1-4578d411862e | 3 | private ClassInfo loadClassFromFile(final File file)
throws ClassNotFoundException {
try {
final InputStream in = new FileInputStream(file);
final ClassInfo info = loadClassFromStream(file, in);
if (verbose) {
System.out.println("[Loaded " + info.name() + " from "
+ file.getPath() + "]");
}... |
21b4857a-df9b-41c4-be10-009ee233b990 | 7 | public boolean equals(Object o) {
if (!(o instanceof BitMatrix)) {
return false;
}
BitMatrix other = (BitMatrix) o;
if (width != other.width || height != other.height ||
rowSize != other.rowSize || bits.length != other.bits.length) {
return false;
}
for (int i = 0; i < bits.l... |
678fac5f-7dbd-4857-9e36-4efc330f8a43 | 5 | @Override
public String toString() {
String temp = " Supported Actions:\r\n";
for (String action : actions) {
temp += " -" + action + "\r\n";
}
temp += "\r\n Supported Transport States:\r\n";
for (String state : supportedTransportStates) {
temp += " -"... |
4d8e4ce1-c64a-43c8-aa92-65be6a4e6742 | 4 | public static void main(String[] args) {
boolean isPrime = true;
for(int i = 2; i < 1000; i++){
for(int j = 2; j < i; j++){
if(i%j == 0){
isPrime = false;
}
}
... |
2e8be787-9ad9-4856-918d-bd43c04208db | 4 | public void run() {
// signal that this thread has started
threadStarted();
while (!isInterrupted()) {
// get a task to run
Runnable task = null;
try {
task = getTask();
}
catch (Int... |
5d47dde6-6043-4b37-b279-0ed02869d856 | 6 | public boolean equals(Object p_other) {
if (this == p_other) {
return true;
}
if (p_other == null || !(p_other instanceof UnderComp)) {
return false;
}
UnderComp l_theOther = (UnderComp) p_other;
if (m_conId != l_theOther.m_conId) {
... |
d685bb09-ab6d-431c-b963-735cae380e0f | 5 | private static int[] translateToArray(String arg, String[] source)
{
List<Integer> array = new ArrayList<Integer>();
StringTokenizer st = new StringTokenizer(arg,",");
while (st.hasMoreTokens())
{
String dayOfWeek = st.nextToken().toLowerCase();
for (int i=0;i... |
c393b4c6-76f5-4885-8ef2-5b57d670a1a3 | 4 | @Override
public void handle(HttpExchange exchange) throws IOException {
System.out.println("In year of plenty handler");
String responseMessage = "";
if(exchange.getRequestMethod().toLowerCase().equals("post")) {
exchange.getResponseHeaders().set("Content-Type", "appliction/json");
try {
//TOD... |
a2643c35-7c67-4f78-a62f-5a4fc2c0f7e5 | 9 | public PrivatePackDialog() {
super(LaunchFrame.getInstance(), false);
setupGui();
getRootPane().setDefaultButton(add);
add.addActionListener(new ActionListener() {
@Override
public void actionPerformed (ActionEvent e) {
if (!modpackName.getText(... |
d2edda27-9575-4aa8-b334-72005cdecbb0 | 9 | public Map<Long, Double> findAvailability(
final ApparelAvailSearchParams searchParams) {
final Map<Long, Double> result = new LinkedHashMap<Long, Double>();
try {
boolean found = false;
rs = stmt
.executeQuery("SELECT store_id, price FROM Bag_Availability WHERE bag_id ="
+ searchParams.getAppa... |
e8d2d62a-7cb9-48f4-af47-b64f96a14feb | 4 | public void makeKing(Checker c) {
if((this.getY() == 0 && c.team == 2) || (this.getY() == 8 && c.team == 1)){
getWorld().addObject(new KingedChecker(c.team), c.getX(), c.getY());
getWorld().removeObject(c);
}
} |
77fea3e3-bd45-4b6f-a0cb-63d6a4daf2dc | 5 | public Location getLocation(Integer locationId, String symbolicId) {
List<Location> list;
if (locationId != -1) {
list = get("locationId = " + locationId);
return list.size() == 0 ? null : list.get(0);
} else if (symbolicId != null && symbolicId.length() > 0) {
list = get("symbolicId = '" + symbolicI... |
eb30e638-3149-41e9-b80f-3543b643ea68 | 0 | @Test
public void testUploadToHdfs() throws IOException {
System.setProperty("HADOOP_USER_NAME", "hduser");
Injector injector = Guice.createInjector(new Context());
HDFS hdfs = injector.getInstance(HDFS.class);
hdfs.init();
hdfs.deleteDirectory("/input/");
hdfs.create... |
d17a66dd-46f7-4ecd-a0c6-60c5bf1d7667 | 3 | boolean isValid() {
return access == IO || access == LEAF_IN || access == OUT || access == 7;
} |
5996eb2b-de18-4137-bff4-b146670a44d0 | 7 | static private int jjMoveStringLiteralDfa9_0(long old0, long active0) {
if (((active0 &= old0)) == 0L) return jjStartNfa_0(7, old0, 0L, 0L);
try {
curChar = input_stream.readChar();
} catch (java.io.IOException e) {
jjStopStringLiteralDfa_0(8, active0, 0L, 0L);
... |
76727f64-b71d-4992-bdea-a17dad991d5a | 1 | public void AtualizaPosDosVertices(Point deslocamento) {
Colider colider = this.getColider();
for (Point ponto : colider.pontos) {
ponto.x += deslocamento.x;
ponto.y += deslocamento.y;
}
} |
a0ffbfd5-bff4-4e54-862f-a71039bd0506 | 3 | @Override
public void set(E newValue)
{
// double checking
if (newValue != null)
{
if (value == null)
{
synchronized (this)
{
if (value == null) {
this.notifyAll();
this.value = newValue;
}
}
}
}
this.value = newValue;
} |
91b12b61-f05f-4355-a8a2-8265cb688a30 | 5 | protected Gene<?>[] crossover( Individual p2)
{
Gene<?>[] newGenotype = new Gene<?>[this.genotype.length];
int crossPnt = (int) Math.floor( random.nextFloat() * this.genotype.length );
for( int i=0; i < crossPnt ; i++ )
{
newGenotype[i] = this.genotype[i].clone();
}
for( int i=crossPnt; i < gen... |
0b71b7ce-1796-4637-9054-3b47b46eb1de | 3 | void setItemFont () {
if (!instance.startup) {
table1.getItem (0).setFont (itemFont);
}
/* Set the font item's image to match the font of the item. */
Font ft = itemFont;
if (ft == null) ft = table1.getItem (0).getFont ();
TableItem item = colorAndFontTable.getItem(ITEM_FONT);
Image oldImage = item.get... |
38e0d28d-375f-4aff-90e2-ad59c870767c | 9 | static void plotClipped(int x, int y, int z, int argb, int argbBackground,
Graphics3D g3d,
int textWidth, int textHeight, int[] bitmap) {
int offset = 0;
int shiftregister = 0;
int i = 0, j = 0;
while (i < textHeight) {
while (j < textWidth) {
... |
d5589802-7d80-4653-8217-f83f9c6f30bb | 6 | public List getIPEntries(String s) {
List ret = new ArrayList();
try {
// 映射IP信息文件到内存中
if (mbb == null) {
FileChannel fc = ipFile.getChannel();
mbb = fc.map(FileChannel.MapMode.READ_ONLY, 0, ipFile.length());
mbb.order(ByteOrder.LIT... |
017121b8-fbdb-4cd3-8913-c753aeb3197c | 3 | public void setPlateSeparation(double separation){
if(separation<=0.0D)throw new IllegalArgumentException("The plate separation, " + separation + ", must be greater than zero");
this.plateSeparation = separation;
if(this.plateWidth!=-1.0)this.distancesSet = true;
if(this.distancesSet)thi... |
d0ebc105-1fd5-4b59-9ed1-3a2a6412d065 | 6 | public void interpret_line(String line){
if(logWriterInit){
logWriter.log(4, logKey, "jumping in interpret_line\n");
}
String[] split_line = line.split("=");
if(split_line.length != 1){
//is the value a integer?
if(Pattern.matches("\\d*?;", split_line[... |
0c7d782d-dacb-49ea-b672-f7215716b055 | 6 | public static void main(String args[]) {
List_Homework_database MList = new List_Homework_database();
/* 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... |
d8d93c34-d548-4967-8407-5789a5ec807e | 7 | public void setOptions(String[] options) throws Exception {
String manualS = Utils.getOption("manual", options);
if (manualS.length() > 0) {
double val = Double.parseDouble(manualS);
if (val >= 0.0) {
setManualThresholdValue(val);
}
}
String classString = Utils.getOption... |
b1c4a051-20ea-4fc0-9771-7ab1813df33d | 1 | public static void printTable(String title, ArrayList<String> head, ArrayList<Token> body) {
int columnLength = biggestLength(head) + 10;
String titleLine = setTitleLine(title, columnLength*head.size()+head.size()+1);
String simpleLine = setSimpleLine(head.size(), columnLength);
System.out.println(simpleL... |
6ee5f4c6-0e83-4467-ab80-6a2a81a8a9a9 | 5 | public void run() {
while(!stop) {
try {
socket = server.accept();
} catch (Exception e) {
if(!stop) {
parent.error(e.getMessage(),"Error acception connection");
stop=true;
}
continue;... |
3026bb1b-844d-4c5e-b6dc-7e5ece25fda8 | 8 | @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((literal == null) ? 0 : literal.hashCode());
result = prime * result
+ ((predictBIOChunk == null) ? 0 : predictBIOChunk.hashCode());
result = prime * result
+ ((originWord == null) ? 0 : originWord.hash... |
44025e22-42cc-451a-b045-a4d3c56e7719 | 5 | public static String getClippedText(String text, FontMetrics fm, int maxWidth) {
if ((text == null) || (text.length() == 0)) {
return "";
}
int width = SwingUtilities.computeStringWidth(fm, text);
if (width > maxWidth) {
int totalWidth = SwingUtilities.computeStri... |
0008301a-c226-4f36-8a77-4ad42e79eb0c | 8 | private void getDificulty() throws IOException {
System.out.print("Select dificulty (easy, medium, hard): ");
String str = CommandLine.s.next();
if (str.equalsIgnoreCase("Easy") || str.equalsIgnoreCase("e")) {
dificulty = 1;
} else if (str.equalsIgnoreCase("Medium") || str.eq... |
97fd7dcf-c8fb-4aec-8c77-ebee819af6b8 | 2 | public static boolean isDate(String str){
try{
if(!isBlank(str))
format.parse(str);
}catch(Exception e){
return false;
}
return true;
} |
522a9c24-cfa0-43c4-8dd4-43b754147798 | 8 | public boolean equals(Object p_other) {
boolean l_bRetVal = false;
if ( p_other == null ) {
l_bRetVal = false;
}
else if ( this == p_other ) {
l_bRetVal = true;
}
else {
ExecutionFilter l_theOther = (ExecutionFilter)p_other;
l_bR... |
5945e00c-b91b-4bb6-a64d-3054af0cbcc1 | 0 | public boolean isAlive() {
return alive;
} |
6158e3dc-0844-4019-9d57-c478eac3cb17 | 1 | public Object getChild(Object parent, int index) {
Iterator iter = ((TreeElement) parent).getChilds().iterator();
for (int i = 0; i < index; i++)
iter.next();
return iter.next();
} |
5a392d79-3644-40a5-b360-f677dd448787 | 1 | public ByteArray readByteArray()
throws IOException {
int off = 0;
int len = readInt();
byte[] bytes = new byte[len];
while (off < len) {
off += read(bytes, off, len - off);
}
return new ByteArray(bytes);
} |
2039f8bc-4b4d-4d16-8b9c-27f8d573f1e3 | 3 | public Set<String> getKeys(boolean deep) {
Set<String> result = new LinkedHashSet<String>();
Configuration root = getRoot();
if (root != null && root.options().copyDefaults()) {
ConfigurationSection defaults = getDefaultSection();
if (defaults != null) {
... |
ee2ad332-2347-4741-a386-4b87a32c318c | 7 | private void convertDataSet(DataSet dataSet,
HashMap<String, LocationInfo> locations,
HashMap<Integer, UserInfo> users){
String date;
double xCoordinate, yCoordinate;
String[] splittedCoordinates;
// initialize the locations
for (Entry<String, String> entry: dataSet.getLocations().getLocati... |
77cbe0f6-7384-48f8-9fc2-e449f332d39c | 9 | public static void main(String[] args) throws IOException
{
if (args.length < 2)
{
System.out.println("Please specify two files: (i) the ranked input file and (ii) the input file containing the " +
"relevance scores.");
System.exit(1);
}
HashMap<Integer, Double> relevScores = new HashMap<Integer,... |
bd557e34-7c68-4df0-ac72-326a978beccf | 1 | public void onStart(IContext context) throws JFException {
// おきまり
this.engine = context.getEngine();
this.indicators = context.getIndicators();
this.acount = context.getAccount();
// 初期値はfalse
this.rsizone = false;
try {
// 売買結果csv (純正のレポートがヘボすぎるので)
File file = new File("MyStrategy.csv");
prin... |
118e472e-1747-4b43-9fe6-2b970d94b6f9 | 5 | public boolean cobreTodasTwoFlip(Coluna col1, Coluna col2, Solucao sol){
ArrayList<Integer> cobertura1 = col1.getCobertura();
ArrayList<Integer> cobertura2 = col2.getCobertura();
for(Integer entradateste1 : cobertura1){
if(!(sol.getLinhasCobertas().contains(entradateste1))){
... |
fb4193eb-4f05-4cf7-939b-6c656e29277a | 8 | public static int osd_is_key_pressed(int keycode) {
if (keycode >= 256) {
return 0;
}
//TODO /*if (keycode == KEY_PAUSE)
/* {
static int pressed,counter;
int res;
res = key[KEY_PAUSE] ^ pressed;
... |
44ce9bed-816f-4ad0-a0cb-035108d6b582 | 3 | public void startSimulation() {
if (sim == null)
return;
if (sim.getState() == Thread.State.NEW) {
sim.start();
} else if (sim.getState() == Thread.State.WAITING) {
sim.unPause();
}
} |
598b6ff1-b6da-4c2c-a865-06c9c1f2e20b | 2 | @Override
public void execute() {
System.out.println("Production Dialog is off..... Turning on");
Constants.PRODUCTION_WIDGET.interact("Toggle Production Dialog");
final Timer timeout = new Timer(2000);
while(timeout.isRunning() && Settings.get(1173)==1879048192) {
Task.sleep(50);
}
} |
42c0b558-c773-47ca-8043-b5c293228821 | 3 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (obj == this) {
return true;
}
if (obj.getClass() != getClass()) {
return false;
}
Book otherAddressBook = (Book) obj;
return new EqualsBuilder().append(label, otherAddressBook.label).isEquals();
} |
99fb2287-ae02-49b7-882c-3c38f1290785 | 7 | private void loadTextureFromAsset(String name, byte[] data) {
int id = -1;
try {
boolean flag = false;
ByteBuffer texture = null;
if (data == null) {
flag = true;
} else {
String extension = "";
int i = name.... |
8262a1dd-71bc-4878-bdbd-94e9f765ad67 | 2 | public void distributionCartesDepart(Set<Joueur> hjoueur, LinkedList<CarteTroupe> llct){
for(Joueur j : hjoueur){
// Distibution des titres aléatoirement
distributionTitreDepart(hjoueur, hashTitre);
int i = 0;
// On prend la liste de carte troupe du j... |
a7ec8f67-8b1f-4306-b518-88d11223c026 | 6 | public boolean searchMatrix(int[][] matrix, int target) {
if (matrix == null) {
return false;
}
int row = matrix.length;
int column = matrix[0].length;
/**
* from the first, the end of the row. the situation for the loop is set inside the loop
*/
... |
0f26a9a2-9be9-4b3e-8be3-4133a42d2802 | 6 | public static void draw( TileGrid tg, int x, int y, int scale, Graphics g ) {
Rectangle clipBounds = g.getClipBounds();
for( int row=0; row<tg.height; ++row ) {
if( y+(row+1)*scale <= clipBounds.y ) continue;
if( y+row*scale >= clipBounds.y+clipBounds.height ) continue;
for( int col=0; col<tg.width; ++col ... |
9c95a5a7-3ffe-402d-9d49-fe27981b73bf | 1 | private void fill(){
while(true){
al.add(new Bloat());
++count;
}
} |
db77857b-5dc4-4b46-a533-80ba3bd63c6e | 0 | public void setCountryCode(String countryCode) {
this.countryCode.set(countryCode);
} |
7fe4ecac-a788-489e-99fc-6bc918cabb67 | 4 | private void setUpListeners() {
// Action listener for begin button
beginButton.addActionListener (new ActionListener () {
@Override
public void actionPerformed(ActionEvent arg0) {
player1Name.setForeground (Color.BLACK);
player2Name.setForeground (Color.BLACK);
createNewGa... |
7f8245c5-ba99-44bd-9a75-234300c9d084 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Membership other = (Membership) obj;
if (group == null) {
if (other.group != null)
return false;
} else if (!group.equals(other.group))
... |
efcd7924-22fe-4f72-a2ca-814b25da0b4c | 1 | private static long sommeLong(HashMap<VoieEnum, AtomicLong> map) {
long somme = 0;
for (AtomicLong value : map.values()) {
somme = somme + value.get();
}
return somme;
} |
36acdb0f-7375-4fc6-9c22-071aaf6a8df2 | 7 | public void startServerIPTest() {
// send broadcast and start as response listener
if(running)
return;
running = true;
byte[] buffer = initCode.getBytes();
try {
start();
InetAddress in = InetAddress.getLocalH... |
d499a02d-4a7f-453f-8dc5-81c5d6e21f40 | 2 | private Serie buscarSerie(String idSerie){
Serie solucion = null;
for (Serie serie : misSeries) {
if (serie.obtenerTitulo().equals(idSerie))
solucion = serie;
}
return solucion;
} |
2124b44a-c9a7-49e2-997a-26ed04f2ea6d | 4 | public void checkLocation()
{
if(tile[cY][cX] == 5 && map == 0)
{
cY = 245;
cX = 245;
map = 1;
tile[244][246] = 6;
tile[244][244] = 6;
tile[244][245] = 6;
tile[245][245] = 8;
tile[245][244] = 6;
tile[245][246] = 6;
tile[246][245] = 7;
}
if(tile[cY][cX] == 7 && map == 1)
{
cY... |
4d3d1005-7da9-4975-a349-5779492864d3 | 1 | public boolean isTransparent(int offset_x, int offset_y)
{
// TODO : Overlays support.
BufferedImage img = sprite.getImage(sprite_state,frame,direction);
int pixel = img.getRGB(offset_x,offset_y); // Get the RGBA bits
if( (pixel>>24) == 0x00 ) { // Check Alpha bit if 0x00 then its transparent.
return tr... |
49617199-4985-4e68-810f-ea27c3c2382a | 3 | @Test
public void testAsync() {
long begin = System.currentTimeMillis();
try {
Properties p = new Properties();
p.setProperty(KafkaConstants.PRODUCER_TYPE, "async");
// specify the broker ip directly
MessageSenderPool pool = new MessageSenderPool(Runtime.getRuntime().availableProcessors()*2+1,
... |
6b39d460-7c09-4b0a-8b78-dcee4e226e7a | 1 | public String getFile() {
if (file == null) {
throw new RuntimeException("missing file name.");
}
return file;
} |
327814b4-5efd-45f4-aa13-8f4c4e24e169 | 6 | private Image getImage(String filename) {
// to read from file
ImageIcon icon = new ImageIcon(filename);
// try to read from URL
if ((icon == null) || (icon.getImageLoadStatus() != MediaTracker.COMPLETE)) {
try {
URL url = new URL(filename);
... |
fa262ff5-8637-4435-bf20-671181bec2a4 | 9 | private void createProductTable() {
MouseAdapter mouseListener = new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
handleMouseEvent(e);
}
@Override
public void mouseReleased(MouseEvent e) {
handleMouseEvent(e);
}
private void handleMouseEvent(MouseEven... |
28a75376-dc98-4c40-9c6b-9dcf010c5179 | 7 | public void update() {
--delay;
if(delay == 0) {
setVisible(true);
} else if(delay == -10) {
setVisible(false);
} else if(delay == -11) {
setVisible(true);
} else if(delay == -12) {
setVisible(false);
} else if(delay == -13) {
setVisible(true);
} else if(delay == -14) {
setVisible(false)... |
c68e753d-4ba1-4319-a44d-4d1f62d770f0 | 7 | public void printInfo(StateBuffer in) {
if(in.size() == 0) {
System.out.println("StateBuffer EMPTY!");
return;
}
curGb.restore(in.getStates().iterator().next()); // restore some state
Util.runToNextInputFrame(); // skip to menu, ensuring mons are loaded
int enemyHP = Util.getMemoryWordBE(curGb.pokemon.... |
16f9f31b-97fb-46ce-9f3e-fda8b1ad5625 | 3 | public String getTitle() {
Object value = library.getObject(entries, "Title");
if (value != null && value instanceof StringObject) {
StringObject text = (StringObject) value;
return cleanString(text.getDecryptedLiteralString(securityManager));
}
else if (value ins... |
d2f81884-54bd-4f41-a106-98ddc97d3914 | 7 | @EventHandler
public void onEntityDeath(EntityDeathEvent event)
{
if (plugin.spawnedMobs.contains(event.getEntity()))
{
plugin.spawnedMobs.remove(event.getEntity());
return;
}
if (event.getEntity().getLastDamageCause() instanceof EntityDamageByEntityEvent)
{
EntityDamageByEntityEvent damageEvent =... |
51906af1-42a5-4985-b474-4fd03d9e48b2 | 9 | private boolean parseRow()
throws IOException
{
boolean continueParsing = false;
HtmlTag tag = new HtmlTag();
while (nextToken() != HtmlStreamTokenizer.TT_EOF)
{
int ttype = getTokenType();
if (ttype == HtmlStreamTokenizer.TT_TAG)
{
try
{
m_tok.parseTag(getStringValue(), tag);
in... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.