method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
64f0fd66-63ec-4c9f-b0ca-729d4ead2c6d | 4 | @Test
public void testDataAnalyzer(){
set_rows(50);
set_columns(50);
bootStrap();
ravageDetectedPatterns = dataAnalysisManager.getRavageDetectedPatterns();
protonDetectedPatterns = dataAnalysisManager.getProtonDetectedPatterns();
Assert.assertEquals(true,protonDetecte... |
fa1cfbff-95dc-4727-9c7b-67d1d105ab13 | 7 | public int init(String[] args) throws IOException, ClassNotFoundException, InterruptedException,
InstantiationException, IllegalAccessException {
DefaultOptionBuilder obuilder = new DefaultOptionBuilder();
ArgumentBuilder abuilder = new ArgumentBuilder();
GroupBuilder gbuilder = new GroupBuilder();... |
d3a68b98-9542-42d2-a92e-0420f9c37a3b | 9 | private void postPlugin(final boolean isPing) throws IOException
{
// The plugin's description file containg all of the plugin data such as name, version, author, etc
final PluginDescriptionFile description = plugin.getDescription();
// Construct the post data
final StringBuilder data = new StringBuilder();
... |
11966ae1-dcd9-46a4-81b1-d02438bfbc93 | 5 | static public void decodeAllFilesInDirectoryExceptSound(String src)
{
File folder = new File(src);
File[] listOfFiles = folder.listFiles();
for (File file : listOfFiles) {
if (file.isFile())
if(!file.getName().substring(file.getName().length()-3, file.getName().length()).toLowerCase().equa... |
7153f481-a1de-4354-b072-4ed430da203e | 9 | int[] interpolate()
{
int[] interpPixel = new int[4];
if (nailed)
{
interpPixel[RED] = (int)colors[bullseye * 4 + RED];
interpPixel[GREEN] = (int)colors[bullseye * 4 + GREEN];
interpPixel[BLUE] = (int)colors[bullseye * 4 + BLUE];
interpPixel[ALPHA] = (int)colors[bullseye * 4 + ALPHA];
... |
4d6884ad-4a48-4fb4-bf9e-d03e36bc2e5f | 7 | private int coinChangeRecursiveHelper(int[] coins, int remain, int[] count) {
if (remain < 0) return -1; // not valid
if (remain == 0) return 0; // cool, we find the solution
if (count[remain - 1] != 0) return count[remain - 1]; // we have already visited it, then reuse it.
int min = Integer.MAX_VALUE;
... |
2d5f882e-08fd-45eb-a477-402de3f9f285 | 7 | private void verifyAndPrepareParam(Map<String, String> textMap,
StyleConfig styleConfig) throws TextImageException {
// 验证textMap
if (textMap == null || textMap.size() == 0) {
throw new TextImageException("textMap cant be empty!");
}
// 如果未传入样式,创建默认样式
if (styleConfig == null) {
throw new TextImageExc... |
9d1d31d9-9992-4a4b-864d-3f4da23eb005 | 8 | private int readToBuffer() throws IOException {
int position = 0;
int charactersRead = 0;
while ((position < BUFFER_SIZE) && (!this.complete) && ((charactersRead = this.reader.read(this.buffer, position, 1)) != -1)) {
if ((Character.getType(this.buffer[position]) == Character.OTHER_PUNCTUATION) && (position ... |
d6529188-efdd-49b5-85b3-dedae21812b2 | 2 | ModelAndView handle(HttpServletRequest request, HttpServletResponse response) throws Exception {
final HandlerMapping handlerMapping = applicationContext.getBean(HandlerMapping.class);
final HandlerExecutionChain handler = handlerMapping.getHandler(request);
Assert.assertNotNull("No handler found for request, che... |
47cbda46-6be0-4c53-bf98-4c51fabb1bfe | 9 | @Override
public void keyPressed(KeyEvent e) {
if (currentCard == 2) {
if (e.getKeyCode() == KeyEvent.VK_LEFT) {
if (grid[player_xpos][player_ypos-1].getIcon() != wallImage) {
grid[player_xpos][player_ypos].setIcon(blockImage);
player_ypos--;
grid[player_xpos][player_ypos].setIcon(playerImage);... |
2f3cbb6c-634e-4836-9865-06e3933d8a8d | 0 | public String getVenue() {
return venue;
} |
ae752011-1096-4ed4-864b-2f41695db748 | 5 | public static void process(File file, File license, String author) throws IOException {
BufferedReader reader = new BufferedReader(new FileReader(file));
String firstLine = reader.readLine();
if (firstLine.equals("/*")) {
reader.close();
return;
}
File tmp = new File(file.getAbsolutePath() + ".tmp... |
f0c8c790-0b13-4f29-9c6c-2434eb990cea | 8 | public void invoke(T instance) throws CmdLineParseException {
// we need to see if there is an array in there somewhere...
int arrayRank = method.arrayIndex;
int otherArgCount = method.args.length;
if (arrayRank >= 0)
otherArgCount--;
int arrayArgs = args.size() - otherArgCount;
Class[] types = ... |
ab2b97a9-1785-48f4-abd5-795bc434f3f6 | 0 | @Override
public String getID() {
return super.getID();
} |
2d27911b-d653-4af0-9fd3-1813e34d3f5b | 5 | public boolean equals(
Object o)
{
if (o == null || !(o instanceof ASN1Set))
{
return false;
}
ASN1Set other = (ASN1Set)o;
if (this.size() != other.size())
{
return false;
}
Enumeration s1 = this.getObjects();
... |
37e6333d-c3b6-4c9b-90cf-e63dbd48fc28 | 7 | public void saveScoreStats() {
File file = new File("Scores.txt");
boolean flag = false;
FileWriter writer;
ArrayList<String> scoreData = new ArrayList<String>();
ListIterator<String> iterator;
try {
Scanner s = new Scanner(file);
while(s.hasNextLine()) {
scoreData.add(s.nextLine());
}
s.cl... |
90c268aa-31c1-4ae2-9447-d5852e11e22f | 8 | private void createReservation() {
final String DATE_FORMAT = "dd/MM/yyyy";
final String TIME_FORMAT = "HH:mm";
Scanner sc = new Scanner(System.in);
Calendar calTime = Calendar.getInstance();
String pax;
String cstName;
String dateStr, timeStr;
String[] date, time;
boolean isValid = false;
do {
S... |
fc5f6980-18f5-47c5-b43e-71aea72e49fe | 8 | private static void loadTopologyLinkMetric(List<String> tokens, Link<?> link) throws Exception {
if ((tokens.size() < 2) || (tokens.size() > 3))
throw new Exception("Invalid number of parameters in link metric declaration");
HardwareInterface<? extends Message> if1= link.getHead();
IPInterfaceAdapter ip_if1= (... |
2a8c94f8-44f2-4a12-8f9d-ef633d97993b | 9 | @Override
public List<Item> fetchWornItems(long wornCode, short aboveOrAroundLayer, short layerAttributes)
{
final Vector<Item> V = new Vector<Item>();
final boolean equalOk = (layerAttributes & Armor.LAYERMASK_MULTIWEAR) > 0;
int lay = 0;
for (final Enumeration<Item> i = items(); i.hasMoreElements();)
{
... |
46129b66-bd7c-46b9-b3cc-fc3cde24cbff | 6 | private List<Location> closestPrey(List<Location> location)
{
Iterator<Location> it = location.iterator();
List<Location> closer = new LinkedList<Location>();
while(it.hasNext()) {
Location where = it.next();
if(where.getCol()==getLocation().getCol()-1 || where.getCol()==getLocation().get... |
06dfbd06-f2ff-4583-be99-cd14ebd5b506 | 2 | public Role getReponseRoleMinimum() {
if (reponseRoleMinimum == null)
if (getCategorieParent() != null)
return getCategorieParent().getReponseRoleMinimum();
else
return Role.Utilisateur;
return reponseRoleMinimum;
} |
c76cbb93-c1cf-402a-9d18-3a72468d844a | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Erbivoro other = (Erbivoro) obj;
if (anni != other.anni)
return false;
if (forza != other.forza)
return false;
if (livelloCibo != other... |
983a6f4e-53bd-47ce-be2a-557c99758d0c | 2 | public boolean indexCheck(int index) {
if (index < 0 || index - 1 > this.length) {
System.out.println("Index out of bounds.");
return false;
} else
return true;
} |
c5889d2d-dafb-4014-8690-84ada7f0f11a | 5 | @Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
drawMaze(g);
for (MazeRat rat : maze.getRats()) {
g.setColor(rat.getColor());
g.fillOval(rat.position.x * TILE_SIZE, rat.position.y * TILE_SIZE,
TILE_SIZE, TILE_SIZE);
double offX = 0, offY = 0;
switch (rat.dir) {
c... |
e56ae4a6-b760-495b-8b8d-8e51dc425c78 | 9 | Color AdvColorPix(int count, String[] ColorIndex) {
int c1;
int c2;
int r;
int g;
int b;
int or; //old red
int og;
int ob;
double dr;
double dg;
double db;
String fg; //foreground colour
String bg; //background colou... |
b43c675c-416e-4196-a207-f5cdfb5b7534 | 6 | public Object getValueAt( int row, int column ) {
Map<String,BasicType> t = this.rows.get( row );
switch( column ) {
case 0: return t.get(Constants.KEY_ID);
case 1: return t.get(Constants.CONFIG_SERVER_ADDRESS);
case 2: return t.get(Constants.CONFIG_SERVER_PORT);
case 3: return t.get(Constants.CONFIG_SERVER_P... |
3d75adfc-deb9-4470-b2da-687fc6fd81ab | 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 Usuario)) {
return false;
}
Usuario other = (Usuario) object;
if ((this.id == null && other.id != null) || (thi... |
f4ec6708-44f5-4a47-a6c6-45fc4cacc0fd | 3 | public String layer_string()
{
switch (h_layer)
{
case 1:
return "I";
case 2:
return "II";
case 3:
return "III";
}
return null;
} |
738763db-e194-4d16-9a04-153590e951f0 | 0 | public Distance getCurrDistance() {
return _distances[_currIndex];
} |
6a3acbeb-334c-417c-8593-4ad43b5a6b4a | 7 | public <T> int updateDB(String query, ArrayList<T> sqlParam){
PreparedStatement ps = null;
int rs = 0;
try{
ps = conn.prepareStatement(query);
int i = 1;
for (T a : sqlParam){
//System.out.println(a.getClass());
if (a.getClass() == String.class){
ps.setString(i, (String)a);
//System.ou... |
d6d7ba9b-f80a-469f-b7fd-2a548619df33 | 7 | private boolean isOtherPowerKeyStillPressed() {
if ((keyCode & A_PRESSED) == A_PRESSED)
return true;
if ((keyCode & S_PRESSED) == S_PRESSED)
return true;
if ((keyCode & LEFT_PRESSED) == LEFT_PRESSED)
return true;
if ((keyCode & RIGHT_PRESSED) == RIGHT_PRESSED)
return true;
if ((keyCode & UP_PRESSE... |
2d697e75-6c35-43c0-aea4-ca57c35b945e | 9 | public void teleport(boolean isTeleport, Teleport teleport) {
if (isTeleport == true) {
if (vx > 0) {
if (x >= teleport.getX1() && y + r >= teleport.getY1() && y <= teleport.getY1() + teleport.getHeight()) {
vx *= randomSwitchDirection();
vy *=... |
c1b96afb-5538-4e90-a8a4-429d38fa2a2d | 1 | public Boolean preparate() {
if (this.cbxFile.getSelectedItem().toString().length() != 0) {
return true;
}
return false;
} |
14da2f91-faa7-41af-94d5-f3de08ad967a | 4 | private void writeObject(ObjectOutputStream s) throws IOException {
s.defaultWriteObject();
for (PropertyChangeListener l : getPropertyChangeListeners()) {
if (l instanceof Serializable) {
s.writeObject(l);
}
}
for (VetoableChangeListener l : get... |
cff0676e-0e81-4143-8f4f-3db41e4cb200 | 5 | public static boolean hasUniqueObject(Collection<?> collection) {
if (isEmpty(collection)) {
return false;
}
boolean hasCandidate = false;
Object candidate = null;
for (Object elem : collection) {
if (!hasCandidate) {
hasCandidate = true;
candidate = elem;
} else if (candidate != elem) {
... |
a64ee0df-ccd6-4614-a386-fc9ea0307df6 | 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://... |
b88c2d1e-aba5-4fe5-9208-3031c9625607 | 8 | public boolean IsInverse(GameDirection Direction)
{
if (this == GameDirection.UP && Direction == GameDirection.DOWN) return true;
if (this == GameDirection.DOWN && Direction == GameDirection.UP) return true;
if (this == GameDirection.LEFT && Direction == GameDirection.RIGHT) return true;
if (this == GameDirect... |
65aadc0a-9534-47f1-8038-f44949259e57 | 3 | void scrollHorizontally(ScrollBar scrollBar) {
if (image == null) return;
Rectangle canvasBounds = imageCanvas.getClientArea();
int width = Math.round(imageData.width * xscale);
int height = Math.round(imageData.height * yscale);
if (width > canvasBounds.width) {
// Only scroll if the image is bigger than ... |
9954e9a3-9661-4639-9d6e-6cc2ed770dad | 8 | public void insertSorted(double distance, Instance instance) {
if (isEmpty()) {
m_First = m_Last = new NeighborNode(distance, instance);
} else {
NeighborNode current = m_First;
if (distance < m_First.m_Distance) {// Insert at head
m_First = new NeighborNode(distance... |
06067d5a-6e50-4036-8ae0-1ad7059774c2 | 1 | public Data(ItemKey<T> key){
if( key == null ){
throw new IllegalArgumentException( "key must not be null" );
}
this.key = key;
} |
50ae5e81-645d-42d9-8360-8f35da3e541f | 6 | @Override
public void execute() {
Variables.status = "Moving from fire";
SceneObject fire = SceneEntities.getNearest(Variables.fire_ID);
if(Players.getLocal().getLocation().equals(Variables.choppingTiles[1]) || Players.getLocal().getLocation().equals(Variables.choppingTiles[0])){
Walking.walk(Variables.fireTi... |
9f2ab096-e78f-412f-9673-4dab70fd56d9 | 4 | public static Formula applyForward(List<Formula> premises) throws BadPremises {
if(premises.size() != 2) {
System.out.println(premises);
throw new BadPremises();
} else {
Formula a = premises.get(0);
Formula b = premises.get(1);
Implies pIq;
Formula p;
if(a.getClass().equals(Implies.class))... |
65bbc4e2-c961-4d06-8a68-07272fccc92b | 9 | public Set<Node> retrieveNodes(IAtomContainer molContent,String moleculeName){
Set<Node> nodes=new LinkedHashSet<Node>();
try{
Set<String> labelZeroNode=new LinkedHashSet<String>();
//labelZeroNode.add(moleculeName);
labelZeroNode.add("molecule");
nodes.add(new Node(new Integer(0),labelZeroNode));
in... |
085214f3-fa85-4ec2-a72c-6262008e6b57 | 1 | public int tLineCount(){
int count = element.tLineCount();
if(program != null)
count += program.tLineCount();
return count;
} |
87fb8bb3-f90f-4518-96fa-f2192c49acb7 | 7 | public static void main(String[] args) throws IOException{
BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb = new StringBuilder();
int n;
int x = 1;
while((n = Integer.parseInt(r.readLine())) > 0){
for(int i = 1; i <= n; i+... |
38e59a75-e39a-4e13-8dfe-e06c5a16b10e | 9 | public static JSONArray JSONArrayOfGenomeFromJsonArray(JSONArray organizedJson, String name){
int len = organizedJson.length();
int i,j,k,l;
JSONArray json = new JSONArray();
boolean ok = false;
for(i = 0; i < len && !ok; i++)
{
JSONArray groups = organizedJson.getJSONObject(i).getJSONArray("groups");
... |
e519f137-a823-49f9-90d2-7192c1c5fc8e | 6 | private void handleJfnikiRequest(HTTPRequest request, ToadletContext ctx)
throws ToadletContextClosedException, IOException, PluginHTTPException {
// djk: why is SFA doing this on every request?
// SFA: afaik this should not be needed, feel free to move this elsewhere.
mWikiApp.setContaine... |
6bfd1961-0960-4e23-ab68-a906e4116111 | 8 | public void checkGameStatus() {
if ( !game.getGameOver() ) {
int redPieces = 0;
int whitePieces = 0;
int redKings = 0;
int whiteKings = 0;
for (Piece p : pieces) {
// System.out.println("for loop23");
if ( p.getColor().equals(Color.red) ) {
redPieces++;
if ( p.isKing() )
redKin... |
7b6ed912-e6a5-4362-86f0-28f52c10c574 | 4 | public TagNode parse(InputStream __source) throws TagParserException, IOException
{
// Prepare
long time = System.nanoTime();
BufferedInputStream source = new BufferedInputStream(__source);
ParseState state = new ParseState();
// Read the document, character by character, byte by byte.
while(true)
{
... |
d3d1c62b-a203-4471-bc32-6a60c847d183 | 0 | public Date getBlogCreatedDate() {
return blogCreatedDate;
} |
76ce6a51-41f6-4b1e-bbfb-8005bfe3f6ac | 6 | private void gameRender() {
if (dbImage == null){
dbImage = createImage(PWIDTH, PHEIGHT);
if (dbImage == null) {
System.out.println("dbImage is null");
return;
}
else
dbg = dbImage.getGraphics();
}
// set background colors depending on theme chosen
if (th... |
910575bd-e465-45bd-88bd-a694c4b86284 | 9 | private void addToCounts(Instance instance) {
double [] countsPointer;
double [] countsNoClassPointer;
if(instance.classIsMissing())
return; // ignore instances with missing class
int classVal = (int)instance.classValue();
double weight = instance.weight();
m_ClassCounts[classVal... |
de6398bd-7d06-471a-ae39-96d4ff313175 | 4 | public boolean eq_b(LuaValue val) {
if (val.raweq(this))
return true;
if (m_metatable == null || !val.isuserdata())
return false;
LuaValue valmt = val.getmetatable();
return valmt != null && LuaValue.eqmtcall(this, m_metatable, val, valmt);
} |
3ec68da9-e442-4cc9-bec6-954c8e8f7a9b | 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... |
6919be60-1198-41ae-bd17-b252b5e0460e | 1 | @RequestMapping(value = "/hall-event-room-event-list/{hallEventId}", method = RequestMethod.GET)
@ResponseBody
public RoomEventListResponse hallEventRoomEventList(
@PathVariable(value = "hallEventId") final String hallEventIdStr
) {
Boolean success = true;
String errorMessage = n... |
e26b7949-e6b3-4dcf-b447-6a7e4b412fe6 | 7 | public static void JoueurVsOrdi(Parametre param){
int taille = 4;
Ligne ligneOrdi = new Ligne(param,true);
Ligne ligneJoueur = new Ligne(param,false);
int nbCoup = 10;
LigneMarqueur liMarq; // récupère la liste des marqueurs après la comparaison
... |
4d7aa2b1-b8b6-46d2-83d3-1a3d7d0e3cdd | 9 | private Log discoverLogImplementation(String logCategory)
throws LogConfigurationException
{
if (isDiagnosticsEnabled()) {
logDiagnostic("Discovering a Log implementation...");
}
initConfiguration();
Log result = null;
// See if the ... |
0d8cde82-39d8-451e-97c0-685b2c58deb8 | 7 | private String startSetToString() {
StringBuffer FString = new StringBuffer();
boolean didPrint;
if (m_starting == null) {
return getStartSet();
}
for (int i = 0; i < m_starting.length; i++) {
didPrint = false;
if ((m_hasClass == false) ||
(m_hasClass == true && i != m... |
48d65f61-0443-4588-893b-733d3a2a1a61 | 8 | public void move()
{
if (Game.keys[0] && x1[3] > 22)
p1Left();
if (Game.keys[1] && x1[6] < 252)
p1Right();
if (Game.keys[2] && x2[3] > 22)
p2Left();
if (Game.keys[3] && x2[6] < 252)
p2Right();
} |
6c2cb8a2-71d5-4f56-862b-881f3474cd3f | 6 | public int getOrbTextColor(int statusInt){
if(statusInt >= 75 && statusInt <= Integer.MAX_VALUE)
return 0x00FF00;
else if(statusInt >= 50 && statusInt <= 74)
return 0xFFFF00;
else if(statusInt >= 25 && statusInt <= 49)
return 0xFF981F;
else
return 0xFF0000;
} |
27c58280-c126-4905-8932-aef9ddd1b32a | 0 | private AlgoChecksumType(String name) {
this.name = name;
} |
4f94053f-ddc9-497b-81a5-d80041c7d5c3 | 5 | public static int updateUserHead(int uid, int u_head) {
int result = 0;
Connection con = DBUtil.getConnection();
PreparedStatement pstmt = null;
try {
pstmt = con.prepareStatement("update mstx_user set u_head=? where uid=?");
pstmt.setInt(1, u_head);
pstmt.setInt(2, uid);
result = pstmt.executeUpdat... |
a3037a79-2efc-461f-a2bd-0b37212b8bd1 | 8 | public EntailmentMetadata_Type(JCas jcas, Type casType) {
super(jcas, casType);
casImpl.getFSClassRegistry().addGeneratorForType((TypeImpl)this.casType, getFSGenerator());
casFeat_task = jcas.getRequiredFeatureDE(casType, "task", "uima.cas.String", featOkTst);
casFeatCode_task = (null == casFeat_tas... |
49389391-4de4-463d-b66c-d5a02d669508 | 2 | private String join(Collection s, String delimiter) {
StringBuilder buffer = new StringBuilder();
Iterator iter = s.iterator();
while (iter.hasNext()) {
buffer.append(iter.next());
if (iter.hasNext()) {
buffer.append(delimiter);
}
}
... |
1b3be35a-7e8c-4b0e-8aeb-ebcb217a2598 | 1 | public static void startAtLastSavedLevel(GameStateManager gsm){
World nw = (World)gsm.getGameState(gsm.getCurrentState());
try {
nw.readFromSave(Save.getWorldData(index));
} catch (Exception e) {
System.out.println("Savefiles not found. Starting new world.");
}
} |
69c4e7ca-1621-4124-8125-d50f49f8b1e2 | 9 | protected void generatePackageFiles(ClassTree classtree) throws Exception {
PackageDoc[] packages = configuration.packages;
if (packages.length > 1) {
PackageIndexFrameWriter.generate(configuration);
}
PackageDoc prev = null, next;
for (int i = 0; i < packages.length;... |
9f8ba5ea-0db4-47d6-bd6c-88a3d4420c1f | 6 | protected boolean startGridlet(SSGridlet sgl) {
int reqPE = sgl.getNumPE();
int partId = sgl.getPartitionID();
boolean success = false;
long runTime = forecastExecutionTime(ratingPE, sgl.getRemainingLength());
double now = GridSim.clock() ;
double finishTime = now + runTime;
... |
73a17c83-5a35-4cc9-a839-0facb668bb3b | 7 | static void consecutiveDownSample(int segmentNo, int R,int cacheSizeControl,int memoryPolicy,int sampleNumPerSeg) throws IOException{
File file = new File(outputpath+"/Segment_"+ segmentNo);
hashRecord = new String[segsize*1024/chunksize];
uniqueRecord = new int[segsize*1024/chunksize];
sampledRecord = new i... |
387ea33f-3890-47f4-907b-0a5b0fda12e8 | 2 | public boolean load() {
try {
if (!configFile.exists()) {
configFile.createNewFile();
getdefaults();
}
config.load(configFile);
save();
return true;
} catch (Exception e) {
return false;
}
} |
dd49386d-1169-4788-b0e0-1e8c9fe129ba | 9 | public int getLineNumber(ASTNode node) {
if (!hasLineNumbers()) return -1;
while (node.getBeginIndex() == Integer.MAX_VALUE && node.getPreviousSibling() != null) {
node = node.getPreviousSibling();
}
int pc = node.getBeginIndex();
L: if (pc > lineNum... |
13efc1b0-bb84-4530-b3e8-03475594235e | 4 | public boolean canExchangeSouls(){
int[] nbrOfCards = new int[SoulTomb.getMaxValue()];
for (int i = 0; i < getNumberOfCards(); i++){
nbrOfCards[cards[i].getIndex()]++;
if(nbrOfCards[cards[i].getIndex()] > 2){
return true;
}
}
for(int i = 0; i < nbrOfCards.length; i++){
if(nbrOfCards[i] < 1){
... |
a4d5df6b-aa31-4429-9be3-8fbc9848057b | 2 | public float moveX(float amount) {
float newX = worldX + amount;
if (newX > maxOffsetX) {
float moved = maxOffsetX - worldX;
worldX = maxOffsetX;
return moved;
} else if (newX < minOffsetX) {
float moved = minOffsetX - worldX;
worldX =... |
668b4279-f4ba-441a-bf25-f305d9208ce9 | 1 | public void storeClass(DataOutputStream out) throws IOException {
if (GlobalOptions.verboseLevel > 0)
GlobalOptions.err.println("Writing " + this);
info.write(out);
info = null;
fieldIdents = methodIdents = null;
} |
872ae13e-b3f9-49c2-99c2-508e4bcf1e40 | 7 | public void testCase_Exon_Simple() {
// Create SnpEff predictor
String genome = "testEmblPberghei";
String resultFile = "tests/testEmblPberghei.genes.embl";
SnpEffectPredictor sep = build(genome, resultFile);
int pos = 4056 - 1;
for (Gene g : sep.getGenome().getGenes()) {
if (debug) System.out.println("... |
d3a7ea0a-fecf-4c73-a8c5-5b26821d46bc | 2 | MyX509TrustManager() throws Exception {
// create a "default" JSSE X509TrustManager.
KeyStore ks = KeyStore.getInstance("JKS");
String trustStore = "jre/lib/security/cacerts";
String javaHome =System.getenv("JAVA_HOME");
ks.load(new FileInputStream(javaHome+ File.separator+trust... |
5207e3ae-4cf1-49ee-8775-45390390505a | 7 | @Override
public GrupoDTO getGrupobyIdGrupo(int idGrupo) {
GrupoDTO g = new GrupoDTO();
Connection con = null;
PreparedStatement pst = null;
ResultSet rs = null;
PreparedStatement pst2 = null;
ResultSet rs2 = null;
try {
con = EscolarConnectionFactory
.getInstance().getConnection();
String sq... |
894bca10-f54c-4546-a75c-ae3d0367fc85 | 2 | private void tableRulesMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tableRulesMouseClicked
if (tableRules.getSelectedRow() == -1) {
return;
}
Rule rule = RulesManager.getInstance().getRuleByName((String) tableRules.getModel().getValueAt(tableRules.getSelectedRow(),... |
abfaf77b-ee72-4815-b7b9-e989d0e8fd0a | 0 | public int add(int param1, int param2)
{
return param1 + param2;
} |
7a49c37f-d1d1-4f1c-890b-71898f859bc5 | 8 | private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
// TODO add your handling code here:
String ost = jTextField1.getText();
String nal = jTextField3.getText();
String merchT = jTextArea1.getText();
if (date.equals("") |... |
f614e96c-4c1f-4bbd-a132-a2671661af7d | 2 | public boolean localSearchSat(ClauseSet clauseSet) {
List<Integer> variables = clauseSet.getVariables();
int radius = Math.round(variables.size() / 2.0f);
boolean satisfiable = localSearch(clauseSet, new Assignment(true),
radius);
if (!satisfiable) {
satisfiable = localSearch(clauseSet, new Assignment(fa... |
404dde76-9c88-42d4-81d4-7872385f3fb4 | 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... |
bac8e714-999d-4c39-907b-c8734db3f5e5 | 5 | @Override
public void run()
{
Map<String, Object> data = new HashMap<>();
int pageSize = Helpers.queryGetInt(rx, "pageSize", 25);
int page = Helpers.queryGetInt(rx, "page", 1);
OrderStatus status = null;
try
{
status = OrderStatus.valueOf(Helpers.queryGetString(rx, "status", ""));
}
cat... |
e50e8ca6-f87a-4b54-8dfe-53a3c16a074f | 0 | public static void main(String[] args) {
float pMax = Float.MAX_VALUE;
float pMin = Float.MIN_VALUE;
System.out.println("Positive Overflow = " + pMax * 10); // Positive Overflow = Infinity
System.out.println("Positive Maximun = " + pMax); // Positive Maximun = 3.4028235E38
System.out.println("Positive Minimum = " ... |
211ce035-90ca-4037-99e1-fab16499a3fd | 8 | private static Map<String, String> flatten(Map<String, String> out, Map<? extends Object, ? extends Object> in, String prefix) {
for (Map.Entry<? extends Object, ? extends Object> e : in.entrySet()) {
if (e.getValue() instanceof Map) {
flatten(out, (Map<? extends Object, ? extends Ob... |
fa49c9f7-6810-437f-8754-27b58182978a | 6 | public static Hashtable<String, Fiche> lireTableFiches() {
FileInputStream fichier = null;
ObjectInputStream in = null;
Object resultat = null;
Fiche uneFiche = null;
Hashtable<String, Fiche> contenu = null;
try {
fichier = new FileInputStream("table.bin");
in = new ObjectInputStream(fichier);
cont... |
78af2849-c94b-4b8c-8df8-c186e68f18ec | 9 | public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, java.io.IOException {
try
{
HttpSession session = request.getSession(true);
UserBean currentUser = ((UserBean) (session.getAttribute("currentSessionUser")));
AlumnoDAO busqueda = ... |
3c0aef1d-0d7f-4f70-b31b-3bbe2ba77088 | 7 | public boolean isCycle(int startingVertex, int cycleLength, int currentVertex)
{
boolean validCycle = false;
if(cycleLength > 2)
{
if(startingVertex == currentVertex) //Wrapped around back to the first node
{
return true;
}
}
if(countConnections(currentVertex) != 2) //Less than two neighbors
{... |
68f6f9ba-92ae-43bf-a134-d23b3db39be8 | 7 | public static void loadBoard(File loadPath, Board board) {
try {
Scanner loadScanner = new Scanner(loadPath);
Block[][] grid = board.getGrid();
while (loadScanner.hasNext()) {
for (int y = 0; y < grid.length; y++) {
for (int x = 0; x < grid[0].length; x++) {
int id = loadScanner.nextInt();
... |
ec5b1506-de31-4a8f-95fb-5f3e2d65ec63 | 6 | @Override
public Response version(VersionRequest request) throws IOException {
Mac hmac=null;
try {
hmac = Mac.getInstance("HmacSHA256");
} catch (NoSuchAlgorithmException e) {
System.err.println("NoSuchAlgorithmException (HmacSHA256 not valid): " + e.getMessage());
return new HmacErrorResponse("Integri... |
6302ee58-0aed-413f-b88e-0f73e19b7098 | 3 | public void analyse(PDFInfoHolder pdfInfoHolder) throws Exception
{
// can't analize if there is no document
if(pdfInfoHolder.getDifferent() == DifferenceType.MISSINGDOCUMENT)
return;
Document pdfFile1 = new Document();
Document pdfFile2 = new Document();
try {
// get pdf document -> create a PDF... |
144e7664-da60-4a11-8927-37861739f0b3 | 9 | @Override
void doRotate(int lo, int mid, int hi) {
final int len1 = mid - lo;
final int len2 = hi - mid;
if (len1 == len2) {
while (mid < hi) {
swap(lo++, mid++);
}
} else if (len2 < len1 && len2 <= maxTempSlots) {
saveAll(mid, len2);
for (int i = lo + len1 - 1, j = hi ... |
9b7daca4-d49e-47c0-bdfa-c84663c40738 | 3 | public static ArrayList<Book> SearchbyRates(Double rate, FakeDateBase fakeDateBase){
ArrayList<Book> result = new ArrayList<Book>();
for (Book book : fakeDateBase.getBooks()){
double avarage = 0;
for (MediadComment comment: book.getRates()){
avarage +=comment.getRate();
}
avarage = avarage/book.getR... |
3ec84100-b6a1-4101-9e88-e95fcccc32ed | 6 | public boolean addState(Gameboy gb, ListState s) {
int stepCount = s == null ? 0 : s.stepCount;
if (stepCount > MAX_STEP_COUNT)
return false;
if (!stateMap.isEmpty() && stateMap.firstKey() + MAX_STEP_COUNT_DIFFERENCE < stepCount)
return false;
if(!stateMap.containsKey(stepCount))
state... |
bf401d2e-ae85-4379-b1ce-fcc65b1d0354 | 0 | public KeyInfoType createKeyInfoType() {
return new KeyInfoType();
} |
65ac66ee-c9ae-406c-8261-a55136795823 | 5 | public String getNym(String sskRequestUri, boolean showPublicKey) {
int start = sskRequestUri.indexOf("@");
int end = sskRequestUri.indexOf(",");
if (start == -1 || end == -1 || start >= end) {
return "???";
}
String publicKeyHash = sskRequestUri.substring(start + 1,... |
bc2202ec-390d-4e85-bd30-0977e9a3ca45 | 9 | public int getAnuncisVigents(String abrev) {
int vigents = 0;
String SQL1 = "SELECT STR_TO_DATE(SUBSTRING(mis.missatge, LOCATE(';eventdate={',mis.missatge)+12,10),'%d-%m-%Y') AS eventDate, "+
"STR_TO_DATE(SUBSTRING(mis.missatge, LOCATE(';eventdate2={',mis.missatge)+13, 10) , '%d-%m-... |
dcccb167-737c-47b8-bdaa-169ba2fa209f | 5 | public void testGoalWithModulePrefix3() {
String goal = "3:length([],0)";
try {
Query.hasSolution(goal); // should throw exception
fail(goal + " (numeric module prefix) didn't throw exception"); // shouldn't get to here
} catch (org.jpl7.PrologException e) { // expected exception class
if (e.term().hasFu... |
9cbd8e99-8a4c-497a-a070-7eb237dd3a02 | 6 | private Vector<Vector<Object>> getContenidoTabla(int perfil){
//r_con.Connection();
Tareas t=new Tareas(r_con);
Permisos p=new Permisos(r_con);
Vector<Vector<String>> v = p.getContenidoTablaPermisos(perfil);
Vector<Vector<String>>tareas = t.getDescripcionTareas();
... |
fa3e8a89-9171-4b8e-90da-93ad8c1a8d13 | 7 | public MatchResult match(EvaluationCtx context) {
// start by evaluating the AD/AS
EvaluationResult result = eval.evaluate(context);
if (result.indeterminate()) {
// in this case, we don't ask the function for anything, and we
// simply return INDETERMINATE
... |
a55501ae-d837-4dfc-bf5e-b90fa767c7fd | 7 | public void parse(PsdInputStream stream) throws IOException {
boolean rle = stream.readShort() == 1;
short[] lineLengths = null;
int height = header.getHeight();
if (rle) {
int nLines = height * header.getChannelsCount();
lineLengths = new short[nLines];
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.