method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
f7c00ed0-77be-45ad-901f-929e3b6951ab | 6 | public void handlePrayerDrain() {
c.usingPrayer = false;
double toRemove = 0.0;
for (int i = 0; i < PRAYER_DRAIN.length; i++) {
if (c.prayerActive[i]) {
toRemove += PRAYER_DRAIN[i]/10;
c.usingPrayer = true;
}
}
for (int i = 0; i < c.curses().CURSE_DRAIN.length; i++) {
if (c.curseActive[i]) {
... |
41a73205-3e34-4ecc-9068-ef95b0bac242 | 5 | public void run()
{
// Chaque navette commence a un site aleatoire.
int n = (int) (Math.random() * Festival.nSites);
while (true)
{
int placeNavette = tSite[n].arret.aller(this);
if (n != (Festival.nSites - 1)) {
// Simulation du temps de deplacement de la navette. (d'un site n au site (n+1).)
... |
11c8ca0b-747b-4681-aa67-967e6c7f8341 | 3 | public synchronized void start(int... ports) {
if (ports != null && ports.length >= 1) {
port = ports[0];
}
if (!listening) {
listening = true;
(new Thread(this)).start();
}
} |
44eb29df-11a2-4998-beba-59f2147d3cc0 | 3 | public void setDirection(int d) {
direction = d;
if (moving) {
if (!timerStarted) {
t = new Timer();
task = new TimerTask() {
public void run() {
if (step == 1) {
step = 2;
} else
step = 1;
}
};
t.scheduleAtFixedRate(task, 0, 125);
task.run();
}
timer... |
40f2e312-faff-43ae-86f0-f7514dab77e3 | 4 | public Entity connect(String activate){
Entity active = null;
if (crates.containsKey(activate)){
active=crates.get(activate);
}
if (walls.containsKey(activate)){
active=walls.get(activate);
}
if (entities.containsKey(activate)){
active=entities.get(activate);
}
if (background.containsKey(activa... |
d4fef06f-75c9-4598-a5e6-2d30fd32e288 | 5 | public void next(int width, int height) {
angle = (angle + 5)%360;
if (vertical) {
if (rectHeight <= 0) {
incHeight = -incHeight;
}
if (rectHeight >= height) {
incHeight = -incHeight;
vertical = false;
}
rectHeight = rectHeight + incHeight;
} else {
if (rectWidth <= 0) {
incWidth... |
275f8ef7-b6e8-4a35-82fc-47d65df880e7 | 8 | private void initComponent(){
setLayout(null);
try {
fondoDecorador= ImageIO.read(getClass().getClassLoader().getResource("images/juego/fondo.png"));
imgInJe = ImageIO.read(getClass().getClassLoader().getResource("images/juego/jefeT.png"));
imgInFu = ImageI... |
135b87dd-4036-42c4-a4a8-986842cb6de3 | 4 | @Override
public void draw(boolean isStick)
{
gl.glPushMatrix();
gl.glTranslatef(this.origin[X], this.origin[Y], this.origin[Z]);
this.drawSphere(this.shoulderRadius, 128, 128);
gl.glRotated(shoulderRot * (this.isLeft ? 1 : -1), shoulderRotVec.x(), shoulderRotVec.y(), shoulderRot... |
8c28094a-7e7e-435a-a8d7-45e5fda6e109 | 4 | public static void main(String[] args) {
if(args.length<0)
{
System.out.println("Provide input!!");
}
else
{
if(args.length==2)
{
String filename=args[1];
if(args[0].equals("-s"))
{
//System.out.println("Simple scheme output");
dijikstra graph= new dijikstra();
graph.createGraph(filename);
new Simple(graph,graph.sour... |
e40a030c-538b-4927-acbc-bd7a42f38461 | 1 | public void PreviousQuestion()
{
if(i == 0)
{
i = QuestionCount -1;
}
else
{
// Current Question Id incremented by 1
i--;
}
// Display question in form
this.SetUp();
} |
359ec5a4-fc83-4e8d-8413-16461a51c689 | 0 | public CheckResultMessage errorGetWorkbook() {
return new CheckResultMessage("读取该Excel文件失败:" + fileName,
CheckResultMessage.CHECK_ERROR);
} |
5e3b364f-29c2-4248-b7b7-0ad572764f2f | 2 | @Override
public boolean canImport(TransferHandler.TransferSupport transferInfo) {
if (!transferInfo.isDataFlavorSupported(DataFlavor.stringFlavor)) {
return false;
}
JList.DropLocation dropLocation = (JList.DropLocation) transferInfo.getDropLocation();
... |
982ab169-7f0f-43ec-b3af-c7eda12e8027 | 7 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("application/json");
PrintWriter outp = response.getWriter();
String gameID = request.getParameter("game");
String play = request.getParameter("play");
// is the file... |
44ab43f6-cfee-469e-ac38-2439c54dd666 | 9 | public void scrollCellToView(JTable table, int rowIndex, int vColIndex) {
if (!(table.getParent() instanceof JViewport)) {
return;
}
JViewport viewport = (JViewport) table.getParent();
Rectangle rect = table.getCellRect(rowIndex, vColIndex, true);
Rectangle viewRect =... |
0416b29c-08f6-4446-aa93-b41967a18cbe | 7 | static Handler remove(Handler h, Label start, Label end) {
if (h == null) {
return null;
} else {
h.next = remove(h.next, start, end);
}
int hstart = h.start.position;
int hend = h.end.position;
int s = start.position;
int e = end == null ?... |
a32b5b8f-cd5a-4987-8d6a-88f6ec327877 | 0 | @Override
public String getMaxFileSize() {
return maxFileSize;
} |
5bf6ed6b-099a-4292-a2c8-67791122083b | 8 | public static boolean hasAtLeastOneMethodWithName(Class<?> clazz,
String methodName) {
Assert.notNull(clazz, "Class must not be null");
Assert.notNull(methodName, "Method name must not be null");
Method[] declaredMethods = clazz.getDeclaredMethods();
for (Method method : declaredMethods) {
if (method.getN... |
99d71622-a672-4a69-9c7d-13fedfc5f480 | 2 | public static void sendDirs(Socket socket, Vector<String> vector){
PrintWriter out = null;
try {
out = new PrintWriter(socket.getOutputStream());
} catch (IOException e) {
System.err.println("Cannot get output stream of socket");
System.exit(-14);
}
... |
6d2025de-b550-4a5c-9148-d2a1735f3ff9 | 1 | public void drawFrontal(Graphics g) {
for (int i=0; i < edges.size(); i++) {
edges.get(i).drawFrontal(g);
}
} |
86a51c30-2d23-4dbd-b66d-920f8b1371b8 | 4 | public boolean searchHelper(int[][] matrix, int target, int begin_row, int begin_col, int end_row, int end_col){
int begin_order=begin_row*matrix[0].length+begin_col;
int end_order=end_row*matrix[0].length+end_col;
if(begin_order>end_order) return false;
if(begin_order==end_order) return... |
21d2cec2-ae31-4be1-b19a-4b1e112f60dd | 3 | public synchronized int getNextBlockOffset() {
for(int i = 0; i < this.blockOffsets.length; i++){
if(this.blocks.containsKey(blockOffsets[i]))
continue;
if(System.currentTimeMillis() - this.blockLastRequested[i] < 500)
continue;
this.blockLastRequested[i] = System.currentTimeMillis();
return block... |
e5760af5-9ea8-46b4-a12f-bc2bd6a056b1 | 7 | public static List<String> getActiveTags(final String wikitext, final int position) {
List<String> activeTags = new ArrayList<String>();
Matcher m = tagMatcher.matcher(wikitext.substring(0, position));
while (m.find()) {
if (m.group(1).equals("/")) {
// End tag.
for (int i = activeTags.size() - 1; i >=... |
a78eae2c-5a26-43d5-8fe5-d889742f9839 | 2 | public Account move (Bank old_bank, Account old_account)
{
org.omg.CORBA.portable.InputStream $in = null;
try {
org.omg.CORBA.portable.OutputStream $out = _request ("move", true);
BankHelper.write ($out, old_bank);
AccountHelper.write ($out, old_... |
8a27e871-03cb-4944-9e6d-b014cede9667 | 5 | private static boolean isColorCorrect(ParticleEffect effect, ParticleColor color) {
return ((effect == SPELL_MOB || effect == SPELL_MOB_AMBIENT || effect == REDSTONE) && color instanceof OrdinaryColor) || (effect == NOTE && color instanceof NoteColor);
} |
2d1f1e67-c049-48b9-a668-2a3828d89933 | 2 | public Gui() {
this.overview = new OverviewPane(this);
this.compilProc = new CompilationProcess(overview);
this.setTitle("Less Now v" + LessNow.VERSION);
this.setIconImage(new ImageIcon(this.getClass().getResource("/res/less.png")).getImage());
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.get... |
c4734c37-596d-4901-88ef-8c8890234f0d | 4 | public void keyPressed(KeyEvent e) {
int key = e.getKeyCode();
if (key == KeyEvent.VK_LEFT)
{ dx = -1;
}
if (key == KeyEvent.VK_RIGHT) {
dx = 1;
}
if (key == KeyEvent.VK_UP) {
dy = -1;
}
if (key == KeyEvent.VK_DOWN) {
dy = 1;
}
} |
df84e235-c08c-493f-9cf6-1b81ccb82511 | 5 | public boolean move(char sc, int sr, char dc, int dr) {
int[] array = translateMove(sc, sr, dc, dr);
int sRow = array[0];
int sCol = array[1];
int dRow = array[2];
int dCol = array[3];
if (outOfBounds(sRow, sCol) || outOfBounds(dRow, dCol)) {
System.out.println("Out of bounds!");
return false;
}
... |
fe8ba008-f57f-4adc-b079-6cc1dfba5bf4 | 1 | @Test
public void searchTest() {
for (int i = 1; i < 9; i++) {
System.out.println("");
int[] array = initRandomArray(10000 * (int) Math.pow(2, i));
printTime(testJavaLinkedListIndexOf(array));
printTime(testDoublyLinkedListSearches(array));
}
} |
8d858400-b7c7-4d5e-beb6-8fad5afca360 | 8 | public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
for (int a = 1; a <= 9; a++) {
for (int b = 0; b <= 9; b++) {
for (int c = 0; c <= 9; c++) {
if (n == a * 2 + b * 2 + c) {
System.out.println("" + a + b + c + b + a);
}
}
}
}
for ... |
ed597098-436c-48f2-a1d2-0c17e1f485b2 | 9 | public static SearchResult bfsSearch(final boolean useGraphSearch){
PriorityQueue<BFSSearchNode> fringe = new PriorityQueue<BFSSearchNode>();
SearchResult searchResult = new SearchResult();
fringe.add(new BFSSearchNode(startState, null, null, 0)); // add root node
searchResult.numNodesEnqueued++;
... |
5c280fa2-a0cd-4a59-878f-dd91f1b54549 | 8 | private boolean r_shortv() {
int v_1;
// (, line 49
// or, line 51
lab0: do {
v_1 = limit - cursor;
lab1: do {
// (, line 50
if (!(out_grouping_... |
7a439a78-1f50-49e2-86dc-8a9098f890e4 | 0 | public Dimension getPreferredScrollableViewportSize() {
return getPreferredSize();
} |
7258fe0b-fabd-475c-b94a-2b4d037fa677 | 3 | public void move(boolean right, boolean left){
if(right){
if(left){
//no changes
} else {
moveRight();
}
} else {
if(left){
moveLeft();
} else {
stop();
}
}
} |
394c4f9d-9a74-413a-853d-080fb271a969 | 2 | public void remove(){
EntityManager em = conecta();
try {
Medico m = em.find(Medico.class, idMedico);
em.getTransaction().begin();
em.remove(m);
em.getTransaction().commit();
} catch (Exception e) {
if (em.getTransaction().isActive())
... |
37096880-041c-47b7-a2bb-2d3b34f8eb33 | 1 | private static String signPerDigits(int amountOfDigits, String sign){
StringBuilder sb= new StringBuilder ("");
int count = 0;
while(count < amountOfDigits){
sb.append(sign);
count++;
}
return sb.toString();
} |
3023072b-8a7e-44f2-bc56-ac465f60339a | 9 | @Override
public void run() {
int top, left;
if (m_isBody) {
top = Window.getScrollTop();
left = Window.getScrollLeft();
} else {
top = m_scrollParent.getScrollTop();
left = m_scrollParent.getScrollLeft();
... |
c5b4bb72-f3c7-4fa3-a063-ce3dc7d97b25 | 2 | public void complete() {
Collection productions = new HashSet(pToT.keySet());
Iterator it = productions.iterator();
while (it.hasNext()) {
Production p = (Production) it.next();
if (alreadyDone.contains(p))
continue;
Transition t = (Transition) pToT.get(p);
automaton.addTransition(t);
}
} |
3d061b74-0493-4188-96ee-3bfb2c6250f7 | 7 | public static <T extends DC> Set<Set<Pair<Pair<T,PT<Integer>>,Pair<T,PT<Integer>>>>> getAllPhis(Set<Pair<T,PT<Integer>>> baseSetA,
Set<Pair<T,PT<Integer>>> baseSetB)
{ Set<Set<Pair<Pair<T,PT<Integer>>,Pair<T,PT<Integer>>... |
9db9262f-2b83-4c6c-9130-e6149117f494 | 7 | public static void prepareAnswers() throws IOException {
int kValue = 3;
File dataFile = new File(String.format("res/hamming/geonames_k%d_testdata.csv", kValue));
List<String> data = readDataAsStrings(dataFile);
// for (int i = 0; i < data.size(); i++) {
// System.out.println(i + ": " + data.get(i));
// ... |
825a1e69-2322-434b-a10b-dfc934eaf8f4 | 2 | public void createLanguages() throws IOException, InvalidConfigurationException
{
//Check each language and send a message if it was made and didnt exist.
for (String S : Language.Languages)
if (Language.makeLangIfNotExist(S)) getLogger().info("Created language file for '"+S+"'");
} |
e9ad28dd-f406-440f-9c2f-0bb42e906575 | 7 | private static boolean letterHelper(String indicator, String content, String item){
int index = 0;
if (indicator.equals("end") || indicator.equals("ends") || indicator.equals("last")){
index = item.length()-1;
}
if (indicator.equals("second")){
index = 1;
}
String[] words = content.split("\\s+");
St... |
e364b967-2769-4c55-a135-116dc06e6125 | 0 | public static float getMinDestToRad() {
return MinDestToRad;
} |
81dc15f6-5fa5-4a93-96bf-357398d00927 | 2 | public static void main(String[] args) throws Exception {
BudgetFormData formData = new BudgetFormData();
formData.setSubmittedOn(new Date());
formData.setSalary(new BigDecimal("2000"));
List<CoreBudgetItem> coreBudgetItemList = new ArrayList<CoreBudgetItem>();
coreBudgetItemLi... |
308f1f0f-7aa8-40c0-81e0-2091b3dc572b | 1 | public String getTripTo() {
if (river == null)
return "<?>";
return river.getTripTo();
} |
70e7e9a8-5cd0-43d1-8621-dd9b19fe46e7 | 4 | @Override
protected Pizza createPizza(String type) {
Pizza pizza = null;
PizzaIngredientFactory ingredientFactory =
new ChicagoPizzaIngredientFactory();
// 用 枚举类型 替换
if ("cheese".equals(type)) {
pizza = new CheesePizza(ingredientFactory);
pizza.setName("Chicago Style Cheese Pizza");
} else if (... |
616aaf66-1a2b-497a-9097-7bb23c4a701a | 7 | public static EnumCities getCityByLetter(String letter) {
switch (letter.toLowerCase()) {
case "a":
return EnumCities.A;
case "b":
return EnumCities.B;
case "c":
return EnumCities.C;
case "d":
return EnumCities.D;
case "e":
return EnumCities.E;
case "f":
return EnumCities.... |
cf4d6ad1-69fd-450d-827f-8bd90eb0e6c4 | 2 | public ArrayList<Pair<String, Color>> getSectionColors(String section, String pref) {
ArrayList<Pair<String, Color>> buf = new ArrayList<Pair<String, Color>>();
for (String j : map.keySet()) {
String[] val = j.split("\\.");
if (val[0].equals(section)) {
buf.add(new Pair<String, Color>(pref + val[1], Color... |
0bb4e361-c62f-4431-b487-1ac884cd9d56 | 8 | @Override
public void transform(String owner, MethodNode methodNode) {
MethodNode mn = methodNode;
Analyzer<BasicValue> analyzer = new Analyzer<BasicValue>(new RedundantNullCheckInterpreter());
int potentialProblemsCount = 0;
int surelyRedundantCheck = 0;
try {
... |
f904865e-ea2e-4495-86d5-392cc7583c21 | 4 | public void addFrame(BufferedImage img, long stepTime){
if(img!=null && !running){
images.add(img);
times.add(stepTime);
totalTime += stepTime;
}else if(running){
System.err.println("Animations cannot be edited once started");
try{
throw new Exception();
}catch(Exception e){
e.printStackTra... |
84443262-3595-4d31-a699-0b2624d66fb5 | 6 | public static void main(final String[] args) throws Exception {
final Date now = new Date();
System.out.println("start LoadFFF\t" + now);
System.out.println("\tfor details see: http://www.win-vector.com/blog/2011/01/sql-screwdriver/");
System.out.println("\tfor latest version see: https://github.com/WinVector/S... |
137526a9-a9e8-4894-b404-cf022eef32fa | 6 | protected String determineTargetUrl(final Authentication authentication) {
boolean isUser = false;
boolean isAdmin = false;
final Collection<? extends GrantedAuthority> authorities = authentication.getAuthorities();
for (final GrantedAuthority grantedAuthority : authorities) {
... |
d73c26ed-3285-4aa1-8bee-c5527b5d1e92 | 0 | public void createAndShowGUI() {
panel = new DrawingPanel();
controlPanel = new JPanel();
frame = new JFrame("Ant Attack - World");
controlFrame = new JFrame("Ant Attack - Controls");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
controlFrame.setDefaultCloseOperat... |
a4dc1cc0-2dc4-4b6b-834d-b034ce894e15 | 0 | public static ArrayList<Excel> generateCube(int side, ArrayList<Excel> base, Excel center)
{
ArrayList<Excel> result = new ArrayList<Excel>();
result.addAll(LineGenerator.Brezenhem(base.get(0), base.get(1)));
result.addAll(LineGenerator.Brezenhem(base.get(1), base.get(2)));
result.addAll(LineGenerator.Breze... |
d295f26d-4439-4f9c-9872-dc540f8689fe | 0 | private CRC64() {
} |
70513732-37a8-412b-a14b-94eeac9b00a9 | 9 | private static int method503(char arg0[], char arg1[], int arg2) {
if (arg2 == 0) {
return 2;
}
for (int k = arg2 - 1; k >= 0; k--) {
if (!Censor.method517(arg0[k])) {
break;
}
if (arg0[k] == '@') {
return 3;
}
}
int l = 0;
for (int i1 = arg2 - 1; i1 >= 0; i1--) {
if (!Censor.metho... |
562b6a12-7cd9-4843-83da-5d8c59b71c65 | 5 | public void run(){
InputStreamReader reader = new InputStreamReader(this.stream);
BufferedReader bufferedReader = new BufferedReader(reader);
String line = null;
do {
try {
line = bufferedReader.readLine();
if(line!=null){
if(type==Type.STDERR){
System.err.println(line);
} else if(typ... |
d40d64bc-d313-432e-9569-bde33de4e056 | 0 | public String getOtro() {
return otro;
} |
3c939695-10e9-452b-9da0-afc28fb72387 | 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... |
b349c281-69b2-41e8-ba32-6fa54986a71c | 8 | private void renderGrid(Grid grid) {
this.fill(this.gridSpace, this.screenBackgroundColor);
Tile[][] tiles = grid.getTiles();
GridPoint selectedLocation = grid.getSelectedLocation();
this.calculateGridOffset(grid, selectedLocation);
Set<GridPoint> targetLocations = grid.getTargetTiles();
AreaOfEffect areaOf... |
241e704d-c2ba-4b37-9448-2f0d8437b8bb | 7 | @Override
public boolean onCommand(CommandSender sender, Command cmd, String lavel, String[] args){
Player target = null;
if(args.length == 0 && !(sender instanceof Player)){
sender.sendMessage("You must target a player from the console.");
return false;
}
if(args.length == 0 && sender instanceof Player)... |
38ccebc9-13d9-43e7-a156-ad4faf85a382 | 1 | public static void main(final String[] args) {
Log.makeLog("SOAPBinaryCycConnection.log");
try {
SOAPBinaryCycConnection soapBinaryCycConnection = new SOAPBinaryCycConnection();
soapBinaryCycConnection.setTrace(soapBinaryCycConnection.API_TRACE_MESSAGES);
Base64 base64 = new Base64();
Lo... |
31bc5ffe-13b9-4fe2-b1da-f3064d9bb06e | 8 | public void Generate(int x, int y, int nestSize, int foodSize, int foodAmmount, int foodDensity, int rockAmmount) {
antWorld = new AntWorld(x, y);
for(int i=0; i<x; i++) {
antWorld.setHexagon(new Hexagon(i, 0, Hexagon.ROCK));
antWorld.setHexagon(new Hexagon(i, y-1, Hexagon.ROCK));
}
for(int j=1; j<y-1; j+... |
92a17573-ddbb-4899-bc19-9c4433bfe5e6 | 2 | private static XmlFilter<Element> createFilter( Element root, String tag, boolean required ) throws IOException
{
XmlFilter<Element> filter = new XmlFilter<Element>( root.getElementsByTagName( tag ), Node.ELEMENT_NODE );
if (required && !filter.hasNext())
{
throw new IOException( "Tag " +... |
0b791e58-89e3-4664-9197-29ebc11da71e | 7 | private void addElemBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addElemBtnActionPerformed
String st = elemAddField.getText().trim();
Elem el = null;
if (st.isEmpty() == false) {
String type = (String) typeCbox.getSelectedItem();
try {
... |
750482cd-3d2a-4890-9bd1-de5a600da20a | 3 | public final void setMode(Mode mode) {
this.mode = mode;
switch (mode) {
case WRITE:
setEditable(true);
component.setClassName("input-tag input-tag-mode-write");
break;
case SELECT_BOX:
setEditable(true);
... |
9110217a-547a-4697-8712-3e9a1a6b66f1 | 5 | @Override
public void init()
{
super.init();
// get the row information
rw = ByteTools.readShort( getByteAt( 0 ), getByteAt( 1 ) );
;
col = ByteTools.readShort( getByteAt( 2 ), getByteAt( 3 ) );
;
ixfe = ByteTools.readShort( getByteAt( 4 ), getByteAt( 5 ) );
// get the value
int num = getByteAt( 6 )... |
9975d069-6004-42e3-af7c-49817d07a19f | 4 | public void formCityList(SessionRequestContent request) throws ServletLogicException {
Criteria criteria = new Criteria();
criteria.addParam(DAO_ID_COUNTRY, request.getAttribute(JSP_ID_COUNTRY));
User user = (User) request.getSessionAttribute(JSP_USER);
if (user != null) {
cr... |
c4526bcc-9800-4644-9570-abf993dcee38 | 3 | public void updateTitle( boolean changed ) {
String title;
title = this.getTitle();
if ( changed ) {
if ( !title.endsWith( "*" ) ) {
this.setTitle( title + "*" );
} // if
} // if
else {
if ( title.endsWith( "*" ) ) {
title = title.substring( 0, title.length() - 1 )... |
c369e1c1-45fd-4cbe-9faa-ba664d6aed90 | 0 | public FromIterable(Iterable<T> source, Selector<T, Iterable<T2>> selector)
{
this._source = source;
this._selector = selector;
} |
9004f95a-a3ac-4527-913d-a73cc3c6a854 | 1 | private void writeCommand(String mode, String command) {
try {
_connection.getOutputStream().write((mode + command + Constants.CR_LF).getBytes());
} catch (IOException e) {
_logger.error("Failed writing to output stream");
}
} |
a05f508e-6566-4f9a-ac9d-6c8f127fba6f | 3 | protected void initialize() {
super.initialize();
if (GameApplet.thisApplet == null)
return;
this.initialOrientation = 90;
this.newName = "Hermes Prototype";
this.chassis = "Hermes";
String[] arrayOfString = { "sensor.VidSensor" };
this.parts = arrayOfString;
this.clearAnimations =... |
858787b0-e783-4c0b-b280-3fee4903d86c | 0 | public void setProblem(Problem problem) {
this.problem = problem;
} |
0b4a97f1-ec74-47fd-8223-63f96bbc6246 | 9 | public static void readAllCSVFiles(String path)
{
logger(TAG + "_readAllCSVFiles: Looking for .csv in " + path);
MyFileNameFilter csvFileNameFilter = new MyFileNameFilter(CSV_EXT);
File directory = new File(path);
if (!directory.exists() || !directory.isDirectory())
... |
19aef774-7901-4ed8-98c0-3a034ba7a4e8 | 3 | private void getData() {
Calendar calendar = Calendar.getInstance();
int hour = calendar.get(Calendar.HOUR_OF_DAY);
int minute = calendar.get(Calendar.MINUTE);
int second = calendar.get(Calendar.SECOND);
String labelText = "";
if (hour < 10) {
labelText = labe... |
dddf64bf-1817-4428-9b32-3650bb1de3b0 | 2 | public static Float getFloat(Object obj){
if(obj == null) return null;
try {
Float f = Float.parseFloat(obj.toString());
return f;
}
catch(Exception e){
return null;
}
} |
669a3429-5672-4096-ac28-80ed1f09e342 | 1 | public double getScale() {
return Config.zoom ? _scale : 1;
} |
e055e378-c62d-40cd-ab86-7bc962bd7274 | 5 | private static void run() throws InterruptedException {
while (!finished) {
Display.update();
if (Display.isCloseRequested()) {
finished = true;
} else if (Display.isActive()) {
Display.sync(FRAMERATE);
logic();
... |
88781293-abb5-4670-9752-23194edc641d | 9 | public void start(){
if(w1==500)System.exit(0);
int current = 1 , turn = 1;
int w=0;
while((w=checkWin(turn,state))==0)
{
if(current == 1)
{
pl1.playTurn(1,turn);
refreshGrid();
current = 2;
}
... |
1b3e86cc-e665-4d42-b9ff-b6a9d4616c35 | 7 | private void applyUpdates(){
for(Neuron n : this.input){
n.applyBiasChanges();
for(Synaps s : n.getconnectedTo()) s.applyWeightChange();
}
for(List<Neuron> h : this.hidden){
for(Neuron n : h){
n.applyBiasChanges();
for(Synaps s : n.getconnectedTo()) s.applyWeightChange();
}
}
for(Neuron n ... |
a6dbe4eb-37fc-49b5-a424-62b12ab42f88 | 0 | public Map<String, Object> valuesWithMappingNames(
ValueVisitor defaultVisitor) {
return values(0, defaultVisitor);
} |
7ecc2231-6574-4c77-802a-6fd97955d612 | 9 | public Endereco(String rua, int numero, String bairro, String cidade,
String estado) throws Exception {
if (rua == null || rua.equals("")) {
throw new Exception("Nome da rua Invalido");
}
if (numero < 0) {
throw new Exception("Nome da Rua Invalido");
}
if (bairro == null || bairro.equals("")) {
... |
78b403fd-d3c3-4ba3-9ab4-ed0324ab898f | 8 | public void commandFind(String channel, String sender, String login, String hostname, String message) {
String command = null;
boolean isCommand = false;
for (String prefix : prefixes) {
if (message.startsWith(prefix)) {
isCommand = true;
command = message.replace(prefix, "");
continue;
... |
8dcdecff-bf0c-4e2a-af64-cb3e150424c0 | 8 | public static Shader loadFromFile(File vs, File fs) {
Shader shader = new Shader();
StringBuilder vertexShaderSource = new StringBuilder();
StringBuilder fragmentShaderSource = new StringBuilder();
BufferedReader reader = null;
try {
reader = new BufferedReade... |
ff6d3bcd-67da-4eda-9e01-8b893242b41c | 2 | public DnDYesNoOption(String valueString) {
if (valueString.equalsIgnoreCase("yes"))
value = true;
else if (valueString.equalsIgnoreCase("no"))
value = false;
else
throw new RuntimeException("Only yes/no votes accepted");
} |
37c4ea39-cc60-42b0-9f16-06d63ce8adb0 | 2 | private Image getSecondaryImage() {
Panel panel = (((Window) getTopLevelAncestor()).getPanel());
JFileChooser chooser = new JFileChooser();
chooser.addChoosableFileFilter(panel.fileFilter);
chooser.setAcceptAllFileFilterUsed(false);
chooser.setFileFilter(panel.fileFilter);
chooser.showOpenDialog(TrackingAnd... |
c2efae3f-1245-487f-a601-01d00a666334 | 9 | public void checkActions() {
if (mInput.right()) {
if (currentPageNumber < mSection.getSize() - 2) {
flipPage(2);
} else {
if (currentSectionNumber < sections.length - 1) {
currentSectionNumber++;
currentPageNumber =... |
0b36aa16-c0c8-480f-9c37-ee7d851afe23 | 3 | private static boolean hasMaterial(Material toFind, ItemStack[] contents) {
for (ItemStack is : contents) {
if (is == null) {
continue;
}
if (is.getType().equals(toFind)) {
return true;
}
}
return false;
} |
bc6827af-294d-4523-bc3d-0fe94e5c1ce3 | 5 | private FunctionFactoryProxy parseFunctionFactory(Node root)
throws ParsingException
{
FunctionFactoryProxy proxy = null;
FunctionFactory generalFactory = null;
FunctionFactory conditionFactory = null;
FunctionFactory targetFactory = null;
// check if we're starting ... |
0d4ebb0b-67af-4f45-9f83-1a857f54109b | 5 | public boolean hasSharedInput() {
return left.hasSharedInput(right) || left.hasSharedInput(middle) ||
middle.hasSharedInput(left) || middle.hasSharedInput(right) ||
right.hasSharedInput(left) || right.hasSharedInput(middle);
} |
d21d23c3-46f3-4ed8-bdbb-9e4f00f1574d | 2 | private void init(int id) {
String ticker = Database.dbSet.get(id);
technicals = Database.TECHNICAL_PRICE_DATA.get(ticker);
addMouseListener(dateDisplayer);
tickerID = id;
setTextDescriptionInArray();
DataPointGraphic prices = new DataPointGraphic("", ticker, 4);
charts.add(prices);
for (String s : D... |
9b887fa8-4afa-4a9c-afde-ff9a652c1a8f | 4 | public static void main(String[] args) {
// TODO Auto-generated method stub
String[] roman = generate();
for (int i = 1; i < 4000; i++) {
if (roman[i].equals(intToRoman(i))) {
System.out.println(i + "pass");
} else {
System.out.println(i + "fail");
}
}
System.out.println("--------------------... |
e4125cb5-7a64-429e-a80e-dae52abba568 | 8 | private void afficherMenuPersonnel() {
try {
System.out.println(" =======================================================");
System.out.println("Bienvenue dans votre espace personnel. Vous pouvez :");
System.out.println("1. Fixer un coefficient");
System.... |
e91aaa5c-6994-4287-9c6a-1851006eeeb9 | 1 | public AllFeatureCommand(CommandParameter par) {
if(par == null)
throw new NullPointerException("AllFeatureCommand has a null CommandParameter");
this.par= par;
} |
d44eac53-3fbd-4e15-9a44-7774e8a77674 | 5 | Varargs push_captures(boolean wholeMatch, int soff, int end) {
int nlevels = (this.level == 0 && wholeMatch) ? 1 : this.level;
switch (nlevels) {
case 0:
return NONE;
case 1:
return push_onecapture(0, soff, end);
}
LuaValue[] v = new LuaValue[nlevels];
for (int i = 0; i < nlevels; ++i)
... |
c9191bc6-1698-4deb-869d-eee3c9aaaab6 | 5 | public static boolean class_exists(String classname,boolean loadClass) {
String key = "!" + classname + "!";
if (classes.matches(key)) {
return true;
}
if (noClasses.matches(key)) {
return false;
}
boolean exists = false;
Utils u = new Utils();
exists = u.class_exists(classname);
if (exists)... |
f1437830-32b4-4d3f-a958-b8bb4b0260c2 | 1 | public void insertarProducto(Producto p){
try {
Statement comando=connection.createStatement();
comando.executeUpdate(
"INSERT INTO Productos" +
"(idProducto," +
"Nombre," +
"Ref," +
"Prec... |
00d1c60a-5b4f-4be3-bf5a-5420d8c4cbbe | 0 | public String getWorkingDay() {
return WorkingDay;
} |
dfe61d30-b7e8-474e-87ce-b134b903a0c0 | 7 | public void fillDeck()
{
int z = 0;
for(int i = 0; i < 20; i++)
{
switch (z)
{
case 0: addCard(new fireAllLasers()); z++; break;
case 1: addCard(new fireAllMissiles()); z++; break;
case 2: addCard(new... |
2b670db0-0555-40b5-a704-5e65710d7d2a | 4 | public void updatePlot() {
// Removes the plot data
ChartData.removeAllData();
// Remove the clusters selection and click
clickedClusterId = -1;
mouseOverClusterId = -1;
// Update the plot data
Collection<CentroidData> centroids = QeAData.getCentroidDataList();
for (CentroidData centroidData : centroi... |
890483d1-7dd2-4d4d-82c1-f09056597317 | 7 | protected final short get_action(int state, int sym)
{
short tag;
int first, last, probe;
short[] row = action_tab[state];
/* linear search if we are < 10 entries */
if (row.length < 20)
for (probe = 0; probe < row.length; probe++)
{
/* is this entry labeled with our S... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.