method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
ca9e59de-9236-4d81-90d3-0fe9be81d914 | 1 | private void showNextQuestion(){
// output in order
// currentWord = wordList.get(currentWordIndex);
// currentWordIndex++;
if (listForRepetition.isEmpty()){
nextPhraseBtn.setEnabled(false);
saveStatsToFile();
phraseQuestion.setText("That was last phra... |
51d51119-0923-490b-9030-acba9a826e47 | 4 | public static void main(String[] args) throws NotBoundException,
FileNotFoundException, IOException, MessageNotFoundException {
Configurator config = Configurator.getInstance();
// Get Registry Server
Registry registryMaster = LocateRegistry.getRegistry(
config.getMasterHostname(), config.getMasterPort()... |
08a9f831-7e3d-468c-80cb-68c6b86a49cd | 3 | private static void removeStudentFromTable() {
String fName = new String();
String lName = new String();
lName = JOptionPane
.showInputDialog("Please enter the last name of the student to remove.");
fName = JOptionPane.showInputDialog("Now enter his/her first name.");
int indexOfStudent = studentExists(... |
b3420a0b-6ec1-4076-8f65-694e5715b9b4 | 7 | public void ChangeWords(int caretPosition, JTextPane txtContent) throws BadLocationException
{
if((System.currentTimeMillis() - lastTimeStamp) > timeUntilNextWordChange){
lastTimeStamp = System.currentTimeMillis();
}
if(isCharALetter(txtContent, caretPosition)) {
if(!this.wordChan... |
6895379e-d3c4-4c53-b345-a2dcf5f677a7 | 1 | @Override
protected void process(List<ProgressReportStruct> pilr) {
for (ProgressReportStruct element : pilr) {
Main.gui.updateTree(element.page, element.type, element.value);
}
} |
1f089b0a-2e87-42ae-b672-7b90c37c0aab | 0 | private String createJarResourceURL(File jarFile, String resourceName, String fsep) throws MalformedURLException {
String url = "jar:" + jarFile.toURI().toURL() + "!" + fsep + resourceName;
return url;
} |
5ac8294d-16ca-41f8-ad30-397eb7c1861f | 5 | private void validate(Cliente cliente) {
if (cliente == null) {
throw new SaveException("Cliente não pode ser vazio.");
} else {
if (cliente.getNome() == null || cliente.getNome().equals("")) {
throw new SaveException("Nome não pode ser vazio.");
} els... |
96232651-7bcb-4831-a159-433e42d11e12 | 5 | private void frameUpdate() {
// Update the frame counter. Used by the zombie AI, etc.
if (frameCounter > FPS) {
frameCounter = 1;
}
// Call the right method depending on the game mode.
switch (mode) {
case TITLE:
titleHelper();
... |
8783b8ff-79aa-4b9e-9187-83407ab2b03f | 7 | private void loadImages(){
try{
File directory = new File(ITEM_IMAGE_PATH);
File[] fileList = directory.listFiles();
for(File file : fileList){
itemImageMap.put(file.getName().split("\\.")[0], new ImageIcon(file.getAbsolutePath()));
}
}catch(Exception e){
CodeSource src = this.getClass().get... |
1111fd9f-a213-456c-b7b9-13bab3cf5ebc | 5 | private AnalyseFilter getAnalyseFilter()
{
AnalyseFilter af;
String ext = Constantes.FILE_EXTENSION ; // bug #489240
String ID = "";
FileChooserFilter ff;
if (chooser.getFileFilter() instanceof FileChooserFilter) {
ff = (FileChooserFilter) (chooser.getFileFilte... |
e73be198-1d88-419b-9ce6-8fa48e8183e9 | 7 | public boolean tick(double speed) {
// XXX note that we use inGameStateNextFrame here, because this is an
// indication of whether the timer should exist for the upcoming
// frame. However, another timer in the timer set may change the
// state, so there's actually a race condition here.
if (parent_state!=nu... |
a21acb1a-60cb-4075-b763-1114e6c55dd1 | 6 | public static void importDefaultUnits() {
SAXBuilder sxb = new SAXBuilder();
try
{
Document fic = sxb.build(new File("units.xml"));
Element root = fic.getRootElement();
List<Element> systems = root.getChil... |
27f1c13a-5da8-4db3-9f98-4eb7bcf7471f | 3 | @Override
public BigDecimal calculateTotal() {
PointOfSaleTerminal.quantityOfProducts();
Double res = new Double(0);
Set<Map.Entry<String, Integer>> set = mapOfQuantityProducts.entrySet();
for (Map.Entry<String, Integer> entry : set) {
String codeOfProduct = entry.getKey();
Integer quantityOfProduct = ... |
def6a3c9-672f-47e7-995d-6ade7f3b3fe1 | 3 | public void removePlayerMP(String username) {
int index = 0;
for(Entity e : getEntities()){
if(e instanceof PlayerMP && ((PlayerMP)e).getUsername().equals(username)){
break;
}
index++;
}
this.getEntities().remove(index);
} |
9386e51d-2355-4c03-a7ea-374e70fda95c | 7 | void helpon (int what){
switch(what){
case '1':
System.out.println("The if:\n");
System.out.println("if(condition) statement;");
System.out.println("else statement;");
System.out.println("");
break;
case '2':... |
5727f570-9f16-4bd8-8094-6fb342beb9c1 | 2 | public static void main(String[] args) {
Random rand = new Random(47);
int i = rand.nextInt(100);
int j = rand.nextInt(100);
System.out.println("i = " + i);
System.out.println("j = " + j);
System.out.println("i > j is " + (i > j));
System.out.println("i < j is " + (i < j));
System.out.println("i >= j is... |
3ec4c9e4-ebba-411b-b2cd-5ce0de6084e0 | 1 | @Override
public void setVisible(boolean visible) {
if (visible) {
mWasAlive = true;
}
super.setVisible(visible);
} |
5759804c-b7da-4b7e-af35-be20cc5f8381 | 7 | private static int [][] getMap(Class<?>... ignoredObstacles) {
int x_dem = Field.getInstance().getXBound() + 2;
int y_dem = Field.getInstance().getYBound() + 2;
int[][] map = new int[x_dem][y_dem];
Set<Class<?>> ignoredObst = new HashSet<Class<?>>();
for (Class<?> obstCl... |
85a9e914-5db2-46f4-b992-60cb98db7477 | 1 | public Answer(AnswerCombination answerCombination,
boolean additionalAttemptPossible, boolean targetFound, int attemptsCount) {
if (answerCombination == null) {
this.nb_blacks = 0;
this.nb_whites = 0;
} else {
this.nb_blacks = answerCombination.getBlackCount();
this.nb_whites = ans... |
97dba4a0-c154-4901-b43b-a10c7b822aca | 5 | public void checkScroll()
{
// only do this if we are not zoomed out
if (sampleWidth != zoomOutWidth) {
// get the rectangle that defines the current view
JViewport viewport = scrollSound.getViewport();
Rectangle rect = viewport.getViewRect();
int rectMinX = (int) rect.getX();
... |
512767d6-1116-42cd-89fc-f6604192862a | 5 | private Set<Usager> loadDB() {
Set<Usager> lu = new HashSet<Usager>();
try {
String req = "SELECT * FROM USAGER";
Statement statement = DB.getConnexion().createStatement();
ResultSet rs = statement.executeQuery(req);
while (rs.next()) {
Us... |
9ccc3639-13eb-4ff9-b307-963d1b2da3f8 | 7 | public void run() {
// thread info
while(true){
CurrentGC = CurrentLvl.getGC();
if (CurrentGC.getGotten() && (CurrentLvl.getNextLevel() != null)){
CurrentLvl = CurrentLvl.getNextLevel();
try {
Thread.sleep(3000);
} catch (Interrupted... |
bc24a8e4-37d2-43c1-89e7-562f049c3936 | 1 | public void visitRCExpr(final RCExpr expr) {
if (expr.expr == from) {
expr.expr = (Expr) to;
((Expr) to).setParent(expr);
} else {
expr.visitChildren(this);
}
} |
0811f161-0f05-4139-b922-e4852f3ddea5 | 0 | private void btnListarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnListarActionPerformed
Listar listar = new Listar();
listar.setVisible(rootPaneCheckingEnabled);
}//GEN-LAST:event_btnListarActionPerformed |
51036347-87bd-45c2-8951-f33177276133 | 8 | @Override
public String getAsString(FacesContext context,
UIComponent component, Object value)
throws ConverterException {
String inputVal = null;
logger.log(Level.INFO, "Entering CreditCardConverter.getAsString");
if (value == null) {
return "";
... |
128eb537-f166-481e-b36c-4e2d2be2a5ea | 4 | @Override
public void render() {
glPushMatrix();
{
glTranslatef(getPosition().getX(),getPosition().getY(), 0);
// square.render();
// text.render(content);
if (lineDelay.isOver()){
displayDelay.start();
}
if (acti... |
31fae23d-0729-46ce-b7e9-0576918ef056 | 6 | public static void wordBreak(String s, String[] dict, List<String> result) {
// keep this boolean array for keeping isWord[j] if a word finishes at index j
boolean[] isWord = new boolean[s.length() +1];
Map<Integer, List<Integer>> rev = new HashMap<>();
// for zero length string , we ass... |
d85d26ab-1fbd-43e8-bf6c-656177cd231a | 2 | public List<OrgaEinheit> getUnterOrgaEinheiten(){
ResultSet resultSet;
List<OrgaEinheit> rueckgabe = new ArrayList<OrgaEinheit>();
try {
resultSet = db
.executeQueryStatement("SELECT * FROM OrgaEinheiten WHERE idUeberOrgaEinheit = " + this.idOrgaEinheit);
while(resultSet.next()){
rueckgabe.add(new O... |
606dead3-f78f-475c-88be-25fccfefed30 | 8 | public void fillMap( int numPlanets, ArrayList<Player> playerList )
{
PlayerList = playerList;
Planet planet;
double radius;
int population;
double x;
double y;
for( Player player : PlayerList )
{
radius = random.nextInt( 21 ) + 25;
... |
89848fa1-6de8-4920-b97c-43b94c9b5360 | 5 | private void checkMoveIsLegal(VerifyMove verifyMove){
Map<String, Object> lastState = verifyMove.getLastState();
// We use SetTurn, so we don't need to check that the correct player did the move.
// However, we do need to check the first move is done by the white player (and then in the
// first MakeMov... |
470929e2-e76c-47a2-8e87-3a5a776de6ed | 4 | private boolean isFlush(){
int sameSuit=0;
for (int i = 0; i < crds.size()-1; i++) {
if(crds.get(i).getSuitID()==crds.get(i+1).getSuitID()||cmnSID==crds.get(i+1).getSuitID()){
sameSuit++;
cmnSID=crds.get(i).getSuitID();
System.out.println("same cardset--------------------++++++++++++");
crds.g... |
31035621-4781-4e3f-b145-a0c4f9565a06 | 3 | public String mapMethodDesc(String desc) {
if ("()V".equals(desc)) {
return desc;
}
Type[] args = Type.getArgumentTypes(desc);
String s = "(";
for (int i = 0; i < args.length; i++) {
s += mapDesc(args[i].getDescriptor());
}
Type returnType = Type.getReturnType(desc);
if (returnType == Type.VOID_T... |
e1486edb-df33-4e16-8deb-32df8682e364 | 4 | public static ObservedPosition jauAtioq(double ri, double di, Astrom astrom)
{
/* Minimum cos(alt) and sin(alt) for refraction purposes */
final double CELMIN = 1e-6;
final double SELMIN = 0.05;
double v[] = new double[3], x, y, z, xhd, yhd, zhd, f, xhdt, yhdt, zhdt,
... |
dee9e1b3-9963-4cca-b041-1daca1622d04 | 7 | private Set<String> loadResource(InputStream resource) {
Set<String> mwus = new HashSet<String>();
/** The buffered file for reading */
BufferedReader inFile = null;
List<LabeledToken> myList;
String str;
try {
InputStreamReader reader = new InputStreamReader(resource, "UTF-8");
inF... |
24c21981-0295-48bc-bf89-4c4e8fa424c6 | 9 | @SuppressWarnings("deprecation")
public int hashCode() {
CustomItemHashCodeBuilder hashBuilder = new CustomItemHashCodeBuilder();
hashBuilder.append(itemStack.getTypeId());
hashBuilder.append(itemStack.getDurability());
if (itemStack.getData() != null){
hashBuilder.append(itemStack.getData().getItemTypeId()... |
6fd14d5d-7fce-4718-ac7b-c3dc2e9c1f5a | 3 | /* */ public Tileset(String path, int p_width, int p_height) {
/* */ try {
/* 17 */ BufferedImage pictureTileset = ImageIO.read(getClass().getResource(path));
/* 18 */ this.width = (pictureTileset.getWidth() / p_width);
/* 19 */ this.height = (pictureTileset.getHeight() / p_height);
/* 20 ... |
6e063805-fcd4-4967-8887-d8d6c5bb5686 | 8 | public long fillTables() {
// list of relevant source-tables
Iterator it = tables.listIterator();
// holds results of each queried source table
ResultSet result;
// buffer to build SQL-statement for inserting remote data into local temp. table
// (StringBuffer is much faster than String)
Str... |
91ab5e7e-0c1b-4994-b11a-d077edbb37b1 | 9 | public static XMLGuideFile internalise( File src ) throws MVDException
{
try
{
XMLGuideFile guide = new XMLGuideFile();
// use DOM3 to parse
DOMImplementationRegistry registry =
DOMImplementationRegistry.newInstance();
DOMImplementationLS impl =
(DOMImplementationLS)registry.getDOMImplemen... |
7e6c9c80-b68d-4caf-89f9-bae85818d0d6 | 1 | public static List<Colors> getColors() {
List<Colors> colors = new ArrayList<Colors>();
for (int i = 0; i < Colors.values().length; i++) {
colors.add(Colors.values()[i]);
}
return colors;
} |
52e75e2f-07c7-4a4c-9833-f075140c8ae9 | 9 | public static void drawMap(Game g){
DivertionMap m = Divertion.map;
int h = Display.getHeight();
int w = Display.getWidth();
int[] c = m.getCrosshair();
int z = m.getZoom();
int[] bl = new int[]{((c[0] * z) - (w / 2)) / z, ((c[1] * z) - (h / 2)) / z};
for(int i1 = bl[0]; i1 < 1024; i1++){
for(int... |
c4823e38-dd0f-41dd-9153-36117805d3e7 | 2 | protected static StringBuffer fetchData(String url) throws IOException {
URL obj = new URL(url);
URLConnection con;
if (url.startsWith("https")) {
setupConnection();
con = (HttpsURLConnection) obj.openConnection(); // öffnet die
// Connection
// zum Server
// ... |
34bcb3ab-e30e-4943-9e39-5abb8de30c95 | 9 | public Query handleInsertStatement(ZInsert s, TransactionId tId)
throws TransactionAbortedException, DbException, IOException,
simpledb.ParsingException, Zql.ParseException {
int tableId;
try {
tableId = Database.getCatalog().getTableId(s.getTable()); // will
... |
f7b03d82-c2db-49da-b3bb-6417e0cfb055 | 8 | public static Ray getClosestIntersect(Vector origin, Vector direction, PhysicsObject source,
List<PhysicsObject> objects) {
direction = direction.norm();
Vec2 point1 = new Vec2(origin.x, origin.y);
Vec2 point2 = new Vec2(origin.x + direction.x * 1000, origin.y + direction.y * 1000);
// Get a iterator for t... |
9890a3d4-2923-41d5-b619-973b2b1eba44 | 5 | public boolean[] getTipo()
{
boolean tipo[] = new boolean[5];
if(this.jCheckBox1.isSelected())
tipo[0]=true;
else
tipo[0]=false;
if(this.jCheckBox2.isSelected())
tipo[1]=true;
else
tipo[1]=false;
if(this.jCheckBox3.isSe... |
877d8e2a-b397-4572-92e2-8d6a27a8bde7 | 5 | public void neadminather()
{
for(int y1 = 0; y1 <= 24; y1++)
{
if ((min == 20 || min == 40 || min == 59) && sec == 1)
{
sendMessage("Changing weather!");
sendMessage("Current time: "+hour24+" hours "+min+" mins");
IsSnowing = randomWeather();
sendMessage("Weather changed!");
saveweather();
}
}
} |
95d17464-ad10-498b-9466-71820e1f7826 | 6 | @EventHandler
public void SilverfishNightVision(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getSilverfishConfig().getDouble("Si... |
474d9118-089b-4690-996c-2180dd35c2f0 | 3 | public void changerDeVue(String nomVue){
System.out.println("GuiRentaco::changerVue()") ;
if(nomVue.equals("Liste véhicules")){
this.vueVisualiserVehicules.actualiser() ;
}
else if(nomVue.equals("Liste clients")){
this.vueVisualiserClients.actualiser() ;
}
else if(nomVue.equals("Liste locations")){
... |
b7c5c894-57f7-4eff-97c3-31bcbd21e93c | 2 | public void receiveMessage()
throws IOException
{
DatagramPacket packet = new DatagramPacket (payload, payload.length);
mailbox.receive (packet);
SocketAddress clientAddress = packet.getSocketAddress();
ViewProxy proxy = proxyMap.get (clientAddress);
if (proxy == null)
... |
33f62d85-6187-41a6-bd30-5787cc234f87 | 9 | public static void main (String argv [])
{
try {
// FIXME: error diagnostics via {/usr/bin,...}/logger
if (argv.length != 1) {
System.err.println ("USBD [ start | stop ]");
System.exit (1);
}
if ("start".equals (argv [0])) {
Host host = HostFactory.getHost ();
if (host == null)... |
5868164d-fa74-4bfb-ac31-940d184583e7 | 0 | Game() { // Constructor
frame.setTitle("RunBitMan 2");
container = frame.getContentPane();
KeyHandler handler = new KeyHandler();
frame.addKeyListener(handler);
frame.setSize(600, 600);
frame.setVisible(true);
} |
ae414667-a50a-42cb-a48f-c926d2d9b6a7 | 7 | public void setLoadOnDemand() {
if (loadOnDemand)
return;
loadOnDemand = true;
if ((Main.stripping & Main.STRIP_UNREACH) == 0) {
String fullNamePrefix = (fullName.length() > 0) ? fullName + "."
: "";
// Load all classes and packages now, so they don't get stripped
Enumeration enum_ = ClassInfo.g... |
4135dbd9-5286-43de-94e4-b2e83ce06452 | 6 | public static boolean implementsInterface(Class<?> implementor, Class<?> interf)
{
List<Class<?>> interfaces = getAllInterfaces(implementor);
for (Class<?> intf : interfaces)
{
if (intf.equals(interf))
{
return true;
}
}
return false;
} |
8b52346c-ebdc-4cdd-a9c0-a5d1293f2925 | 8 | private Result solveDiag(Board board, boolean isLeft) {
final int dim = board.getDimension();
Entry first = null;
int numMatch = 0;
for (int i = 0; i < dim; i++) {
final int j = isLeft ? i : dim - 1 - i;
final Entry current = board.get(i, j);
if (curr... |
1ac2a9cd-201e-423e-8586-676f9c5bc79e | 9 | public boolean skipPast(String to) throws JSONException {
boolean b;
char c;
int i;
int j;
int offset = 0;
int length = to.length();
char[] circle = new char[length];
/*
* First fill the circle buffer with as many characters as are in the... |
27f4cd15-24ec-46b9-bf95-785c5a44f51d | 5 | private String calculateResult(int surd) {
int[] factorsOfSurd = Mth.factorsOf(surd);
int squareNumber = 0;
int thatOtherNumber = 0;
for (int i = factorsOfSurd.length - 1; i >= 0; i--) {
if (Mth.isSquare(factorsOfSurd[i])) {
squareNumber = factorsOfSurd[i];
thatOtherNumber = surd / squareNumber;
... |
63ddfe8a-0612-427f-bdbd-099e99e91388 | 9 | public void readFile(String str){
JObjective obj = null;
boolean unit=false;
try{
FileReader fr = new FileReader(str);
BufferedReader br = new BufferedReader(fr);
StreamTokenizer st = new StreamTokenizer(br);
st.whitespaceChars(44, 44);
int count2 = 0; //running count to add a... |
ff014070-9076-494f-94bc-50b11b88ac4d | 8 | public void aggiorna(List<GiocatoreView> giocatori, GiocatoreView mioGiocatore) {
giocatori = MetodiDiSupporto.creaListaOrdinata(giocatori, mioGiocatore);
List<GiocatoreView> toDelete = new LinkedList<GiocatoreView>();
List<GiocatoreView> toAdd = new LinkedList<GiocatoreView>();
List<GiocatoreView> toUpdate = ... |
b2d9ed90-adfc-4362-a39d-429d9b231b6f | 7 | private static void parseIndelsBetweenAlignments(File inputBam) {
SAMFileReader bamreader = new SAMFileReader(inputBam);
//put the alignments in a map entry per bac
Map<String, ArrayList<SAMRecord>> mapContigAlignments = new HashMap<String, ArrayList<SAMRecord>>(); ... |
e8555649-af73-4d36-9ccb-25ba4a9a4076 | 6 | final void method624(int i, int i_560_, int i_561_, int i_562_) {
anInt5522++;
for (int i_563_ = 0; (i_563_ ^ 0xffffffff) > (anInt5478 ^ 0xffffffff);
i_563_++) {
int i_564_ = 0xffff & aShortArray5486[i_563_];
int i_565_ = 0x3f & i_564_ >> -435106262;
int i_566_ = (i_564_ & 0x3f5) >> 136053671;
... |
ec489bae-102e-4a45-81b1-d926cd24ed7c | 6 | private boolean isEndofGame() {
int[] monumentCheck = new int[getPlayer(0).getMonumentsPlayerHas().length];
boolean[] listOfMonuments;
for (int i = 0; i < players.size(); i++) {
if (getPlayer(i).getDevelopementList().getAvailableDevelopments()
.size() <= 8) {
return true;
}
listOfMonuments = get... |
7102307c-cf0b-4dd0-9bf0-01eb7b47f337 | 3 | public int emaLookback( int optInTimePeriod )
{
if( (int)optInTimePeriod == ( Integer.MIN_VALUE ) )
optInTimePeriod = 30;
else if( ((int)optInTimePeriod < 2) || ((int)optInTimePeriod > 100000) )
return -1;
return optInTimePeriod - 1 + (this.unstablePeriod[FuncUnstId.Ema.ordinal()]... |
c371681f-0c69-4e81-ac77-7ac6ce47aee7 | 7 | public void setCollapsed(boolean collapsed) {
if (collapsed!=this.collapsed) {
// Change our fold state and cached info about folded line count.
int lineCount = getLineCount();
int linesToCollapse = lineCount - childCollapsedLineCount;
if (!collapsed) { // If we're expanding
linesToCollapse = -lines... |
9f74c460-6baa-43f7-8e28-effee4ea812a | 0 | public void setNom(String nom) {
this.nom = nom;
} |
e6bfb46d-5f0f-44a0-9d45-1c74d10d1c35 | 3 | public void setLeft(PExpLogica node)
{
if(this._left_ != null)
{
this._left_.parent(null);
}
if(node != null)
{
if(node.parent() != null)
{
node.parent().removeChild(node);
}
node.parent(this);
... |
7aabe82f-aafe-4c77-a8c6-c3a58460c304 | 3 | public void removeClosedClients()
{
if(clients != null)
{
LinkedList<Client> tmp = clients;
for(Client client : tmp)
{
if(!client.isConnected())
clients.remove(client);
}
}
} |
c0ed73b5-06f3-46c5-823b-951f51017b70 | 0 | public void drawPlayer(){
sprite.draw((int)absolutex, (int)absolutey);
} |
93a67b77-d1a5-4a36-962a-b0ee5c194c29 | 4 | public void drawXorO() {
if (!isZero) {
new MouseClickedEventSWT(logicField, this, graphicFieldSWT);
}
cellV2.addPaintListener(new PaintListener() {
public void paintControl(PaintEvent e) {
e.gc.setFont(fontForCellV2);
Rectangle clientArea = cellV2.getClientArea();
if (!isClean && !isZero) {... |
b14d133b-dcd8-4918-9ccc-5798ffaa72ed | 2 | public static Integer getEID (String txt) {
Database db = dbconnect();
String query;
Integer _int = null;
try {
query = ("SELECT EID FROM employee WHERE username = ? AND bDeleted = 0");
db.prepare(query);
db.bind_param(1, txt);
Resul... |
29a38330-7f64-455d-8991-a17476176189 | 4 | public Long convert(Object object,Long defultValue,Object... args) throws HeraException{
if(object instanceof Double){
return new DoubleLongConverter().convert((Double)object, defultValue, args);
} else if(object instanceof Integer){
return new IntegerLongConverter().convert((Integer)object, defultValue, ar... |
bb71c90c-3c5d-4665-808b-cefb6005f3cc | 5 | protected PingResult pingDown() {
for (int i = this.posY; i < BattleBotsGUI.instance.yDim; i++) {
if (i == enemyPosY && this.posX == enemyPosX) {
return new PingResult(i - this.posY - 1, true);
}
else if (BattleBotsGUI.instance.obstacles[this.posX][i]) {
... |
b14a31f4-e040-4f2f-97c6-da7f03aab3c4 | 1 | private void readAttributes(final DataInputStream in) throws IOException {
final int numAttributes = in.readUnsignedShort();
attrs = new Attribute[numAttributes];
for (int i = 0; i < numAttributes; i++) {
final int nameIndex = in.readUnsignedShort();
final int length = in.readInt();
attrs[i] = new Gene... |
daceee0c-1ed0-4cbf-9304-e6872fe3af3a | 5 | protected Set<Location> clear(Location location) {
Set<Location> cascade = new HashSet<Location>();
cascade.add(location);
// bfs search for zero count squares
if(count(location) == 0) {
Queue<Location> frontier = new LinkedList<Location>();
frontier.add(location);
Set<Location> visited = new HashSet<... |
5eef5462-09e2-4a84-9b2d-225c1c9e0409 | 9 | @Override
public void startEvent(){
graph.resetGraph();
try{
//--INITIALIZING
height = 0; time = 0;
displacementX = 0; displacementY = 0;
initialVelocity = Double.parseDouble(inputVelocityProjectile.getText());
initialAngle = Double.par... |
785cda9c-02c8-4a9c-b216-e587ff57d409 | 3 | public void debug_stack() {
StringBuffer sb=new StringBuffer("## STACK:");
for (int i=0; i<stack.size(); i++) {
Symbol s = (Symbol) stack.elementAt(i);
sb.append(" <state "+s.parse_state+", sym "+s.sym+">");
if ((i%3)==2 || (i==(stack.size()-1))) {
debug_message(sb.toString());
sb = n... |
dd7af329-e07c-46ef-b82b-50829e92f506 | 1 | public Polygon scale(double s) {
Coordinate[] res = new Coordinate[this.corners.length];
for(int i=0; i<this.corners.length; i++)
res[i] = this.corners[i].scale(s);
return new Polygon(res);
} |
cae9fb4e-e619-4865-8df2-26f9d3982c7f | 9 | void menuOpenFile() {
animate = false; // stop any animation in progress
// Get the user to choose an image file.
FileDialog fileChooser = new FileDialog(shell, SWT.OPEN);
if (lastPath != null)
fileChooser.setFilterPath(lastPath);
fileChooser.setFilterExtensions(OPEN_FILTER_EXTENSIONS);
fileChooser.se... |
b2bb868a-5651-4c3c-a32f-c78b60dba9a0 | 4 | public Solicitud getSolicitud(SolicitudDTO solicitudDTO) {
Solicitud solicitud = (Solicitud) accesoBD.buscarPorId(Solicitud.class, solicitudDTO.getId());
solicitud.setId(solicitudDTO.getId());
solicitud.setFecha_solicitud_solicitante(solicitudDTO.getFecha_solicitud_solicitante());
solicitud.setFecha_solicitu... |
f8e93efb-e7f5-4e66-bb59-8c2f9e036810 | 0 | @Override
public void startSetup(Attributes atts) {
super.startSetup(atts);
addActionListener(this);
} |
79fc74be-5491-4e3b-b29c-6477abe24679 | 8 | public Item getItemAndRemove(String strStore)
{
int i,
intNumber=1;
i = strStore.indexOf(".");
if (i != -1)
{
try
{
intNumber = Integer.parseInt(strStore.substring(0,i));
strStore = strStore.substring(i+1,strStore.length());
}catch(NumberFormatException e)
{
intNumber = 1;
}
}
... |
39bd3719-c04c-4bc6-98c2-b02b00c78bb0 | 1 | public void removeKeybindListener(KeybindListener l) {
if(l == null) {
return;
}
keybindListener = null;
} |
24fc66dd-92e8-441a-bd6b-5dc70a2d3237 | 9 | private void jj_rescan_token() {
jj_rescan = true;
for (int i = 0; i < 5; i++) {
try {
JJCalls p = jj_2_rtns[i];
do {
if (p.gen > jj_gen) {
jj_la = p.arg; jj_lastpos = jj_scanpos = p.first;
switch (i) {
case 0: jj_3_1(); break;
case 1: jj_3_2()... |
d14424d3-5c9c-49a2-bf14-b8b2e8987909 | 3 | @Override
public void render(float delta) {
super.render(delta);
if (!menuVisible) {
movementCalc();
}
cameraUpdater();
drawWorld();
if (menuVisible) {
stage.act(delta);
stage.draw();
}
if (DEBUG) {
showRect(sRen);
}
} |
d61f96c0-4ba5-477a-a736-883953d7a705 | 9 | public String actionSubmit() {
if (userId != null && password != null) {
UserVO userVO = getUserService().getUserById(userId);
System.out.println("UserVO===============>" + userVO);
if (userVO != null) {
if (userId != null) {
if (userId.compareTo(userVO.getId()) != 0) {
logWarningMessage("In... |
cb088c47-da13-4928-bebb-a36ef5e00ea5 | 4 | public List<String> getImportantNouns ()
{
List<String> important = new ArrayList<>();
for (int idx = 0; idx < size(); idx++)
{
List<TermPos> phrase = phrases.get(idx);
if (phrase.get(0).type != "BNP") continue;
if (!isFeature(idx)) continue;
List<String> nouns = getNouns(idx);
if (nouns.size() >... |
b827bfb3-8409-4e84-898c-fe31d6306868 | 7 | public void rotationRight(){
switch (polygonPaint) {
case 0:
line.RatationRight();
repaint();
break;
case 01:
curv.RatationRight();
... |
e3a96de8-3880-4690-8cdd-f60e2a83a93c | 1 | public void addToEnd(int value) {
ListElement current = new ListElement(value);
if (count == 0) {
head = current;
} else {
tail.next = current;
}
tail = current;
count++;
} |
698a3797-fa15-4391-8a94-ff0e57e6267b | 5 | public MaplePortal findClosestSpawnpoint(Point from) {
MaplePortal closest = null;
double distance, shortestDistance = Double.POSITIVE_INFINITY;
for (MaplePortal portal : portals.values()) {
distance = portal.getPosition().distanceSq(from);
if (portal.getType() >= 0 && po... |
e6e797b6-45fa-4529-bbb1-93b4ac2f14eb | 1 | private boolean isNumber(char symbol) {
return (('0' <= symbol) && (symbol <= '9'));
} |
4dc34875-a0f5-4d1a-91c1-469a3a6b1aa9 | 8 | private boolean checkStop(double[] rst, double minDL, double dl){
if(dl > minDL+MAX_DL_SURPLUS){
if(m_Debug)
System.err.println("DL too large: "+dl+" | "+minDL);
return true;
}
else if(!Utils.gr(rst[2], 0.0)){// Covered positives
if(m_Debug)
System.err.println("Too few positives.");
... |
d382903d-edfd-4f9e-ad1f-273fe2eea20e | 4 | public static boolean isEmpty( String str ) {
if( str == null )
return( true );
if( str.length() == 0 )
return( true );
char[] chars = str.toCharArray();
for( int i = 0; i < chars.length; i++ ) {
if( !Character.isWhitespace( chars[ i ] ) )
... |
70c277c2-0ac9-4394-88e1-22cd82a80311 | 0 | @Override
public String getMessageText() {
String msg = name + " " + settings.getLanguage().getLabel("text_leftchat");
return msg;
} |
4dfc2a41-201c-4ce1-88ad-e4786c861e33 | 5 | public static void main(String[] args) {
// TODO code application logic here
/**
* ciclo for
*
*/
int cantidad;
int suma = 0;
Scanner teclado= new Scanner(System.in);
System.out.println("digite el #de impresiones que desea ver");
... |
c11e6ce3-8728-4ea4-a9d4-23b4d58a4972 | 1 | public static String[] getRandCode() throws IOException {
//验证码
URL url = new URL("https://kyfw.12306.cn/otn/passcodeNew/getPassCodeNew.do?module=login&rand=sjrand&"
+ new Date().getTime());
HttpsURLConnection con = (HttpsURLConnection) url.openConnection();
con.setSSLSoc... |
2d9e24ff-d03d-4dc5-8e15-995eb54d994a | 2 | public ArrayList<Participant> getParticipants() {
ArrayList<Participant> participantsList = new ArrayList<Participant>();
Iterator<String> participantsIter = participants.keySet().iterator();
Participant partp;
while(participantsIter.hasNext()) {
partp = participants.get(participantsIter.next());
if(partp... |
4a401b51-4867-47d1-b288-a16e414ef2b3 | 5 | public boolean equals(
Object o)
{
if (o == null || !(o instanceof DERBitString))
{
return false;
}
DERBitString other = (DERBitString)o;
if (data.length != other.data.length)
{
return false;
}
for (int i = 0; i != ... |
297a55e4-7672-465c-b823-c25ae9f62d0a | 9 | private static HashMap<Integer, HashSet<VarVersionPair>> getAllVarVersions(VarVersionPair leftvar,
Exprent exprent,
SSAUConstructorSparseEx ssau) {
HashMap<Integ... |
a991d1d7-b8b5-4bb8-8706-81d48c6bf76b | 0 | public WorldListener getWorldListener() {
return worldListener;
} |
99666d4a-b384-4f47-a223-bb1d48771e0e | 5 | public List<SubjectVo> list(int pageNo, int pageSize)
throws Throwable {
Connection con = null;
PreparedStatement stmt = null;
ResultSet rs = null;
try {
con = dataSource.getConnection();
stmt = con.prepareStatement(
"select SNO, TITLE from SE_SUBJS"
+ " order by SNO desc"
+ " limit... |
61a1b39d-2620-4fce-a36d-9beb44d8cfbd | 9 | private static byte[] read_s3m_file( byte[] header_96_bytes, DataInput data_input ) throws IOException {
int s3m_file_length;
int num_pattern_orders, num_instruments, num_patterns;
int instrument_idx, pattern_idx;
int instrument_offset, sample_data_offset, pattern_offset;
byte[] s3m_file;
if( !is_s3m( heade... |
0a8887f0-c7ce-4ce4-b151-c0273aba16ec | 9 | public void setKey(int k, boolean pressed){
switch(k){
case KeyEvent.VK_UP:
if(pressed){
if(selected <= 0)
selected = numOptions - 1;
else
selected--;
}
break;
case KeyEvent.VK_DOWN:
if(pressed ){
if(selected >= numOptions - 1)
selected = 0;
else
selected++;
}
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.