method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
c2bcea39-4d1d-4483-b78c-ae9a39fe43c4 | 0 | public void setKeyDerivationFunc(AlgorithmIdentifierType value) {
this.keyDerivationFunc = value;
} |
705c5044-5974-4772-9574-43de5d9cb915 | 7 | public Initialisation() {
// Lecture des fichiers XML grâce à JDom
this.hashBonus = new JDom("src/fichierxml/Bonus.xml").initialisationJeu("bonus");
this.hashGeneral = new JDom("src/fichierxml/General.xml").initialisationJeu("general");
this.hashKokus = new JDom("src/fichierxml/Kokus.xml... |
56b18f15-a845-4dfa-8793-65eda7c29bbf | 0 | public void addClientToList(DiscoveredClient client)
{
clientList.setVisible(false);
clients.put(client.getUsername(), client);
JRadioButton button = new JRadioButton(client.getUsername());
clientSelectionGroup.add(button);
clientList.add(button);
clientList.setVisible(true);
buttonList.put(button,... |
684bf1cb-f7e8-440f-a001-1e2c96ca83e1 | 8 | public Location findNearestParkingLot(Location location){
//TOP LEFT
if (location.mX < 300 && location.mY < 300) {
return ContactList.cPARKINGLOT0;
}
//TOP RIGHT
if (location.mX > 300 && location.mY < 300) {
return ContactList.cPARKINGLOT1;
}
//BOTTOM RIGHT
if (location.mX > 300 && location.mY > 3... |
deb0c1a3-7915-4cf0-a2c3-70714560dbd3 | 3 | void Scout_crawler (String[] args) throws IOException{
Validate.isTrue(args.length == 1, "usage: supply url to fetch");
String url = args[0];
//String url = "http://www.vimalkumarpatel.blogspot.com/";
print("Checking for saved versions of the url:");
URL ... |
75ad5ad0-cf28-408c-882c-7ce1dcf9c8fc | 8 | public String evaluateRiskColumn_innerMethod(
TransferredFile dbSQLDumpFileToTransfer,
Context initialContext, long gid) {
System.err.println("Method evaluatePolicy_RiskinnerMethod, gid:"+gid+", thread number:"+Thread.currentThread().getId());
logger.writeLog(Level.ALL,"Method evaluatePolicy_RiskinnerMet... |
0be93f19-a75a-4e9e-a36d-319527a7bf95 | 8 | private void updateQueues()
{
while(!taskSet.isEmpty() && taskSet.peek().getArrivalTime() <= currentTime)
{
if(isPreSatisfied(taskSet.peek()))
{
readyQueue.addLast(taskSet.poll());
}
else
{
Task t = taskSet.poll();
t.setWaiting();
waitQueue.addLast(t);
}
}
for(Task t : wai... |
416334c6-56e9-4cd0-bdb4-528ffc3a9998 | 6 | public static Stella_Object getArgumentBinding(Stella_Object arg) {
{ Stella_Object bind = Logic.argumentBoundTo(arg);
if (bind == null) {
return (Symbol.internSymbol(Skolem.getSkolemPrintName(((Skolem)(arg)))));
}
else {
{ Surrogate testValue000 = Stella_Object.safePrimaryType(bi... |
835a4a01-461e-401c-8f15-4c76ff211c9d | 7 | public void randomPiece() {
//int nombreAleatoire = Min + (int)(Math.random() * ((Max - Min) + 1));
int random = 1 + (int) (Math.random() * ((6) + 1));
Piece p1 = new Piece();
switch (random) {
case 1:
barre();
break;
case 2:
... |
bdbe84c3-408d-4847-8326-ee38faa71ca2 | 6 | public static HashMap<String, HashMap<String, Integer>> getMap(String filePath) throws Exception
{
HashMap<String, HashMap<String, Integer>> map =
new HashMap<String, HashMap<String,Integer>>();
BufferedReader reader = filePath.toLowerCase().endsWith("gz") ?
new BufferedReader(new InputStreamReader(
... |
77938873-2093-411f-9cf3-52590bc6febd | 2 | void sortBins(){
Random pom = new Random();
Elem tek=head;
while(tek!=null){
int hlp=pom.nextInt(binNo);
if(bins[hlp].itemNo<=n/binNo){
Elem binHlp= bins[hlp].binHead;
bins[hlp].binHead=tek;
tek=tek.sled;
bins[hlp].binHead.sled=binHlp;
bins[hlp].itemNo++;
}
}
} |
fcdf0142-15a5-4d95-802e-ac50aa733e52 | 5 | @Override
public final void rightRotation() {
int rowLength = WIDTH_FIELDS;
int colLength = HEIGHT_FIELDS;
IField[][] tmpFieldMatrix = new IField[rowLength][colLength];
for (int row = 0; row <= rowLength - 1; row++) {
for (int column = 0; column <= colLength - 1; column++) {
tmpFieldMatrix[row][column]... |
e94eaf20-130b-4892-8166-8205220e3f6c | 4 | public void run()
{
long startTime = System.nanoTime();
LinkedList<Integer> list = new LinkedList();
int length = a.length;
for(int i=0;i<length;i++)
{
for(int j=1;j<length;j++)
{
if(a[j] < a[j-1])
{
int temp = a[j];
a[j] = a[j-1];
a[j-1] = temp;
}
}
}
for(int i=... |
68f3ee7f-110c-4e8e-a5c4-0697c340c150 | 2 | public void updateData(core.Player player)
{
if (lockCount != 0) return;
//System.out.println("update");
statusGold.setText(""+player.getResource(core.ResourceType.GOLD));
statusOre.setText(""+player.getResource(core.ResourceType.ORE));
statusWood.setText(""+player.getResource(core.ResourceType.WOOD));
... |
b1798cb7-ac5a-4278-9d30-f85e9ad9b91b | 7 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Token other = (Token) obj;
if (type != other.type)
return false;
if (value == null) {
if (other.value != null)
return false;
} else... |
e51b2612-e2bc-4b76-9d0d-cce8090c0b6b | 1 | @Override
public void recieveEvent(Event event) {
if(event.getEventType() == EventType.OUTPUT) {
System.out.println("eva > " + event.getData());
}
} |
d5ae14f6-1f7e-4fd8-aed3-10bfdc00ba79 | 9 | protected void beforeAttribValue(final char c)
{
switch(c)
{
case ' ': case '\t': case '\r': case '\n': bufDex++; return;
case '=': bufDex++; return;
case '<':
assignAttrib(bufDex);
piece.innerStart = bufDex;
abandonTagState(State.BEFORETAG);
return;
case '>':
assignAttrib(bufDex);
chan... |
fb9a5c13-33fc-433b-9b62-950db240c02d | 9 | @Override
public void possiblyBumpAchievement(final MOB mob, final Event E, int bumpNum, Object... parms)
{
if((mob != null)&&(E!=null)&&(!mob.isMonster())&&(CMProps.getBoolVar(CMProps.Bool.MUDSTARTED)))
{
ensureAchievementsLoaded();
final PlayerStats pStats = mob.playerStats();
if(pStats != null)
{
... |
c1001a0c-3bda-4531-8070-4d15f1a895ae | 3 | public static void selectSort(int[] array) {
for (int j = 1; j < array.length; j++) {
int selectIndex = j;
for (int k = j; k < array.length; k++) {
if (array[k] < array[selectIndex]) {
selectIndex = k;
}
}
Util.swap(array, j - 1, selectIndex);
}
} |
7f463416-0887-42ad-954a-0dac6fead63c | 9 | protected Converter createConverter()
throws JspException {
FacesContext context = FacesContext.getCurrentInstance();
Converter converter = null;
ValueExpression vb = null;
// If "binding" is set, use it to create a converter instance.
if (binding != null) {
... |
fa4d6730-ae5d-4a7a-bd34-009a0b2fb55c | 4 | public boolean equals(Object obj) {
if (obj instanceof GetUserInfoResult) {
GetUserInfoResult other = (GetUserInfoResult) obj;
return
EqualsUtil.equals(this.user, other.user)
&& EqualsUtil.equals(this.delegate, other.delegate)
&& EqualsUtil.setEquals(this.userVotes, other.userVot... |
c18c2fcd-4e81-46f4-93f0-5a05cd26dcc2 | 2 | public void visitZeroCheckExpr(final ZeroCheckExpr expr) {
if (expr.expr().type().isReference()) {
print("notNull(");
} else {
print("notZero(");
}
if (expr.expr() != null) {
expr.expr().visit(this);
}
print(")");
} |
f05f2efa-3787-43d3-8ee2-a7bbe4cb01b5 | 6 | public void updateArgument(Value old, Value newVal, int branch)
throws Exception {
if(branch < 1 || branch > 2) {
throw new Exception("Incorrect branch number");
}
if(branch == 1) {
if(!getArg1().equals(old)) {
throw new Exception("Old value does n... |
1c5e71d3-a07e-4a01-a202-de502614c57a | 8 | public static void main(String[] args) {
if(args.length < 1){
System.out.println("Incorrect number of arguments, please specify inputfile");
return;
}
boolean timed = false;
boolean sorted = false;
String circuitFilename = null;
String outputFilename = null;
/*
* Parse the arguments
*/
for... |
34352359-49b6-452e-a25c-2dcab86e8ca1 | 9 | private void downloadFile() {
BufferedInputStream in = null;
FileOutputStream fout = null;
try {
URL fileUrl = new URL(this.versionLink);
final int fileLength = fileUrl.openConnection().getContentLength();
in = new BufferedInputStream(fileUrl.openStream());
... |
aeb7ab5f-9f35-451c-991b-d553fa3b223f | 8 | public Response handle(Request req) {
try {
Matcher m = textureUrl.matcher(req.getPath());
m.matches();
String hash = m.group(1);
String id = hash.substring(0, 32);
char type = hash.charAt(60);
URL skinUrl = null;
if (type == '0') { // Skin
skinUrl = skinLookup.get(id);
} else if (type ==... |
070eee1f-10cb-4f80-bb23-6db8556df09b | 4 | @Override
public List<Tour> load(Criteria criteria, GenericLoadQuery loadGeneric, Connection conn) throws DaoQueryException {
int pageSize = 10;
List paramList = new ArrayList<>();
StringBuilder sb = new StringBuilder(WHERE);
String queryStr = new QueryMapper() {
@Overri... |
eaa5a0d8-5daa-484b-b676-1038596f084f | 5 | public synchronized void receive(byte[] bytes, Link l){
int messageType = Tools.getMessageType(bytes);
switch (messageType) {
case Constants.Payload:
Payload payload = new Payload();
payload.unmarshall(bytes);
trackReceive(payload.number);
// Send verification
Verification ack = new Verificati... |
e55236ac-2d9f-447b-a618-416e5da37c09 | 1 | protected Map<Integer, UserData> persistUsers(List<User> objects) throws Exception {
HashMap<Integer, UserData> users = new HashMap<>();
for (User row : objects) {
users.put(row.id, new UserData(row.id, row.firstName, row.lastName, row.gender, row.age, null, null, null));
}
r... |
e8edf58e-c0d9-46f8-9762-7593336980e5 | 2 | @SuppressWarnings("unchecked")
public Map<String, Map<Integer,JSONObject>> load(int module) {
JSONObject json = Encrypter.read("assets/data/" + module + "/");
Map<String,Map<Integer,JSONObject>> classMap = new HashMap<String,Map<Integer,JSONObject>>();
Map<Integer,JSONObject> idsMap = new HashMap<Integer, JSO... |
f3536e36-a389-4474-8c1d-f576533d1d03 | 7 | public void build(final Location loc){
final HashMap<Block, Integer> blocks = new HashMap<Block, Integer>();
List<Block> allBlocks = new ArrayList<Block>();
for(int x = 0; x < schematic.getWidth(); x++){
for (int y = 0; y < schematic.getHeight(); y++){
for (int z = 0; z < schematic.getLength(); ++z){
... |
4de8724d-6da5-488e-bb2c-765dac76457b | 6 | public static float convertPressureUnitIndexToFactor(int index) {
switch (index) {
case 0:
return HPA;
case 1:
return KPA;
case 2:
return PSI;
case 3:
return BAR;
case 4:
r... |
cd816026-8aee-47bd-b3ae-42d31ad5d869 | 2 | public void dbConnect(String db_connect_string,
String db_userid,
String db_password) {
try {
t1 = new Date();
Class.forName("net.sourceforge.jtds.jdbc.Driver");
Connection conn = DriverManager.getConnection(db_connect_string,db_userid, db_password);
... |
6b77663a-7e70-44d4-bba3-09384c3adbf4 | 4 | void insertBars() {
System.out.println("선택한 위치에 bar를 삽입합니다.");
System.out.println("지정한 칼럼과 그 다음 칼럼의 사이에 삽입됩니다. 맨 마지막 칼럼은 선택할 수 없습니다.");
boolean insertingBar = true;
while (insertingBar) {
Coordinate barLeftPoint = null;
Coordinate barRightPoint = null;
while (barLeftPoint == null) {
barLeftPoint... |
f2aa10ad-d3e4-44da-b776-02cd37307519 | 0 | public KeyValueType createKeyValueType() {
return new KeyValueType();
} |
12f81e59-212a-443b-89e8-e7bdd85c3a97 | 5 | public static void PaintNumbers(Graphics2D g, boolean linear, BigDecimal maxValue, double base, int xShift, int yShift, int plotHeight) {
g.setColor(Color.BLUE);
Font font = new Font("Arial", Font.TRUETYPE_FONT, 11);
g.setFont(font);
String drawString = "";
BigDecimal prop = new BigDecimal(Integer.toString(G... |
8ff6f9e2-c3d7-4a63-b3fb-11e548775f0f | 9 | public void perform(Entity target, Entity self){
this.SUCCESS = false;
this.BROKE_GRIB = false;
//Logic
self.cooldown = 120;
int roll = random.nextInt(100);
roll += ((400 - target.energy) / 4);
if(roll < this.SUCCESS_RATE){
JudokaComponent.techniqueTimer = JudokaComponent.timer;
target... |
ed467c89-4925-4f23-9c2b-3ea61b8a41f0 | 5 | public void initialize() throws ResourceInitializationException {
String oPath = (String) getUimaContext().getConfigParameterValue("outputFile");
if (oPath == null) {
throw new ResourceInitializationException(
ResourceInitializationException.CONFIG_SETTING_ABSENT, new Object[] { "outputFil... |
d82975e9-860c-46a5-8796-95228d2ee5ab | 3 | @Override
public void messageReceived(MessageEvent arg0) {
final String msg = arg0.getMessage().toLowerCase();
if (msg.contains("you retrieve a")) {
smelted++;
}
if (msg.contains("the magic of the varrock armour enables you to smelt 2 bars at the same time.")) {
... |
782097f0-8e0e-4e79-ab3a-9f412def05c8 | 4 | public void setTestInfo(TestInfo testInfo) {
if (testInfo == null) {
return;
}
if (this.testInfo != null && !this.testInfo.equals(testInfo)) {
synchronized (this.testInfo) {
this.testInfo = testInfo;
}
} else if (this.testInfo == null ... |
3f199920-2bc6-412a-851e-4c592a66c161 | 5 | protected void connectAndJoin() {
while (!connected) // keep trying until successfully connected
{
try {
bot.setName_(name);
bot.connect(network);
Thread.sleep(1000); // allow it some time before identifiying
bot.identify(command);
Thread.sleep(2000); // allow the ident to go through before j... |
631f484b-0058-4841-b276-ba45925b7a1d | 0 | protected void buildOutlineElement(Node node, String lineEnding, StringBuffer buf) {
// buf.append("<").append(ELEMENT_OUTLINE).append(" ");
//
// if (node.getCommentState() == Node.COMMENT_TRUE) {
// buf.append(ATTRIBUTE_IS_COMMENT).append("=\"true\" ");
// buf.append(ATTRIBUTE_IS_COMMENT_INHERITED).append("=\... |
bd7d6c1d-6efc-45b5-b520-315c8d2adb13 | 2 | public void in_event() {
// TODO: Do we want to limit number of commands I/O thread can
// process in a single go?
while (true) {
// Get the next command. If there is none, exit.
Command cmd = mailbox.recv (0);
if (cmd == null)
break;
... |
ec087777-b70b-4e73-8b26-42470c9bd25f | 4 | public void capture() {
final Getoptions opt = new Getoptions();
try {
final AudioFormat format = getTransmissionFormat();
DataLine.Info info = new DataLine.Info(TargetDataLine.class, format);
final TargetDataLine line = (TargetDataLine)AudioSystem.getLine(info);
line.open(format);... |
73c10eec-d7da-4cfd-8ddd-f509bdef383c | 1 | public void setStopTime(long stopTime) {
if (this.startTime == 0) {
log.error("No entry point");
return;
}
this.allThroughTime += stopTime - this.startTime;
//做完要清空, 防呆
this.startTime = 0;
this.stopTime = 0;
} |
f6291390-5061-4c95-b3b5-e3b971eaf201 | 5 | final int[][] method2557(int i, int i_6_) {
anInt4034++;
if (i >= -75)
method2554((byte) -61);
if (anInt4020 != anInt4024) {
if ((anInt4020 ^ 0xffffffff) == -2) {
((Class322) this).aBoolean4035
= (anInt4022 ^ 0xffffffff) != (i_6_ ^ 0xffffffff);
anInt4022 = i_6_;
return anIntArrayArrayArray4029[... |
e5a69030-ffc0-47b8-bb5c-36f9160f5cb9 | 8 | private void visitLiteral(Node node, Node child)
{
int type = node.getType();
int count;
Object[] propertyIds = null;
if (type == Token.ARRAYLIT) {
count = 0;
for (Node n = child; n != null; n = n.getNext()) {
++count;
}
} e... |
5dcc6f98-33c8-432e-8289-623e26da4ea6 | 8 | private Resource[] getSubResources(Resource p) {
Resource[] cp = new Resource[0];
Resource[] all;
{
Collection<Resource> ta = new HashSet<Resource>();
Collection<Resource> open;
synchronized (ui.sess.glob.paginae) {
open = new HashSet<Resource>... |
c361ef51-25ac-4434-8f79-c691962f12e9 | 4 | public boolean isOptOut() {
synchronized (optOutLock) {
try {
// Reload the metrics file
configuration.load(getConfigFile());
} catch (IOException ex) {
if (debug) {
Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.g... |
6499eb7e-ee42-4c66-9c78-b6f99227d295 | 0 | private void setSlot(byte[] schedule, int slot, byte value) {
int index = (slot * bitsPerSlot) / 8;
int startBit = (slot * bitsPerSlot) % 8;
schedule[index] |= value << startBit;
} |
477d26d7-e0a4-4bd1-bc3a-7ca5e8a4533e | 5 | public boolean standNextTo(Hero hero, Player player)
{
if (hero.getColor() == getColor()) {
return false;
}
Mission m = Mission.getLastInstance();
Player cp = m.getPlayer(getColor());
if (getUnits().size() == 0) {
m.battleFinished(hero.getColor(), player, cp, hero, this, 0, 0, null);
} else if... |
860f3bc9-444b-4ce5-9b65-3482c3bdc9af | 9 | public void step() {
int[][] activeMap = getActiveMap();
boolean mapChanged = false;
enemyMoveCounter++;
for (int i = 0; i < explosions.size(); i++) {
Explosion e = explosions.get(i);
if (e.isDestroyed()) {
explosions.remove(i);
i-... |
f6c4c90d-cb64-4d56-9500-f4e8d9c40949 | 4 | public List<UserMaster> getContactInfo(String twitterID){
query = em.createNamedQuery("UserMaster.findByTwitterID").setParameter("twitterID", twitterID);//UserMasterからUser情報をすべてとってくるクエリを飛ばしている
if(!query.getResultList().isEmpty()){
um=(UserMaster)query.getSingleResult();
query = e... |
36045a45-b950-459a-8764-12a0aab5d8e4 | 4 | public int getDepartureTime() {
int lastState = vehicleState.size() -1; //-1 to get correct array position
/**Presuming that the last vehicleState is the one which is
* required. ie if it was parked that should be its last state,
* if it was archived it should be its last state.
*/
if(this.vehicleState.g... |
0ffee8e0-7f70-49f5-a176-a8f3192e30a4 | 7 | @Override
public List<Quest> getPlayerPersistantQuests(MOB player)
{
final Vector<Quest> qVec=new Vector<Quest>();
for(int q=0;q<CMLib.quests().numQuests();q++)
{
final Quest Q=CMLib.quests().fetchQuest(q);
if(Q==null)
continue;
for(final Enumeration<ScriptingEngine> e=player.scripts();e.hasMoreEle... |
840d5ddc-8d72-4132-be9d-54977c100fe2 | 1 | @Before
public void setUp(){
for(int i = 0; i < 27; i++){
fitness.put(i, (double)i);
}
classUnderTest.setSolutionFitness(fitness);
} |
25682ae3-bce5-4857-b2fb-5a4fec3f0631 | 2 | @Override
public int compareTo(Image o) {
if (this.imagedate == o.imagedate) {
return 0;
}
if (this.imagedate < o.imagedate) {
return 1;
}
return -1;
} |
5c3c5d0a-14b3-4fc4-a665-f749d49f843e | 9 | private int getNumOfSundaysOnMonthFirst(int yearStart, int yearEnd) {
int sumSunday = 0;
int dayStart = getDayStart(yearStart);
for (int i = yearStart; i <= yearEnd; i++) {
for (int j = Calendar.JANUARY; j <= Calendar.DECEMBER; j++) {
if (dayStart == Calendar.SUNDAY) {
sumSunday++;
}
int days;... |
b2cdac5c-cf2c-4847-9ea8-cb51d5626ede | 6 | private void templateWithRoots( String wikiText, String templateId, String[]... suffixes ) {
int idx = findTemplate( wikiText, templateId );
if( idx < 0 ) {
return;
}
int end = wikiText.indexOf( '}', idx );
if( end < 0 ) {
return;
}
String ... |
fa8b9a88-3ff0-4c95-9d94-3defec53591f | 6 | /* */ public static FakeDragon newDragon(String message, Location loc)
/* */ {
/* 44 */ FakeDragon fakeDragon = null;
/* */ try
/* */ {
/* 47 */ fakeDragon = (FakeDragon)fakeDragonClass.getConstructor(new Class[] { String.class, Location.class }).newInstance(new Object[] { messag... |
77fd3f83-b5bf-4433-a376-6ca426fe581c | 0 | public void setStudentId(int studentId) {
this.studentId = studentId;
} |
28ac51a9-9e87-4232-94d3-d8c87bbd5d4b | 2 | public double[] rawItemMaxima(){
if(!this.dataPreprocessed)this.preprocessData();
if(!this.variancesCalculated)this.meansAndVariances();
return this.rawItemMaxima;
} |
d6ccd2fb-33a0-4c7f-bd24-29a711bf90fd | 7 | public void draw(Object obj, Component comp, Graphics2D g2)
{
Color color;
if (obj == null)
color = null;
else
color = (Color) getProperty(obj, "color");
String imageSuffix = (String) getProperty(obj, "imageSuffix");
if (imageSuffix == null)
... |
168b979b-c7e6-46a7-962b-b05cef0d5750 | 6 | public static java.lang.reflect.Method lookupSpecialist(NamedDescription description) {
{ Stella_Object specialistprocedure = Logic.accessBinaryValue(description, Logic.SGT_PL_KERNEL_KB_RELATION_SPECIALIST);
java.lang.reflect.Method functioncode = null;
if (specialistprocedure != null) {
if (((... |
99fddf3f-083b-4b13-97ed-dbacaebe08af | 1 | public List<KeyUsageType> getKeyUsage() {
if (keyUsage == null) {
keyUsage = new ArrayList<KeyUsageType>();
}
return this.keyUsage;
} |
8694a413-d883-4bf3-a240-20880a310369 | 8 | private void parse() {
try {
for (int i = 0; i < args.length; ++i) {
if ("-h".equals(args[i])) {
help = true;
} else if ("-nr-nodes".equals(args[i])) {
numberOfNodes = Integer.parseInt(args[++i]);
... |
538f5525-098c-4419-bd4d-c2a8782677a1 | 5 | public void updateCityColour(String forceName, String cityName)
{
setCityImageLocation(forceName); // Gets the city image path for inForce.
switch (cityName) // Sets the city image for inCity.
{
case "许昌": //gp.getXuchangButton().setIcon(new ImageIcon(... |
62d65389-2e83-42dd-9470-2f44e50e4432 | 3 | @Override
public int write(byte[] pData, int pStart, int pLength) throws AudioDeviceException {
boolean failed = false;
int ret = 0;
for ( AudioDevice dev : this.mDevices ) {
try {
ret += dev.write( pData, pStart, pLength );
}
catch (Exception e) {
failed = true;
//TODO: exception with list
... |
2b49a038-02ad-456d-8c68-5701c2d1b99e | 5 | public static boolean ignoreElementWithAttributeValue(
StartElement startElement, String nameOfElement,
String nameOfAttribute, String[] attributeValues) {
String tagName = startElement.getName().getLocalPart();
boolean found = true;
if (tagName.equals(nameOfElement)) {
... |
5a353995-d226-4da7-be82-9b2886272168 | 4 | private static void readTextFile (Path path){
BufferedReader bufferedReader=null;
try {
//apertura del stream. Los bytes del fichero se decodifican utilizando el CharSet: UTF_8:
bufferedReader=Files.newBufferedReader(path, java.nio.charset.StandardCharsets.UTF_8);
//lec... |
7130f945-e6e3-4b42-9bbe-70d1a80c2656 | 1 | public void setImgPath_ShutdownArrowSym(Path img) {
this.imgShutdownArrowSym = handleImage(img, UIResNumbers.SHUTDOWNARROWSYMBOL.getNum());
if (this.imgShutdownArrowSym == null) {
this.imgShutdownArrowSym = UIDefaultImagePaths.SHUTDOWNARROWSYMBOL.getPath();
deleteImage(UIResNumbe... |
82fb148e-ad52-4f32-8e4d-eaf846b53082 | 0 | public static List<TypePraticien> selectAll(EntityManager em)throws PersistenceException {
List<TypePraticien> lesTypePraticiens=null;
Query query=em.createQuery("select v from TypePraticien v");
lesTypePraticiens=query.getResultList();
return lesTypePraticiens;
} |
b18ac8b2-da12-4885-b279-714dc0dd04a6 | 2 | public void addActionListener(ActionListener listener) {
if (mActionListeners == null) {
mActionListeners = new ArrayList<>(1);
}
if (!mActionListeners.contains(listener)) {
mActionListeners.add(listener);
}
} |
c642825b-b051-475e-af92-e50ec56f5c1e | 0 | public DistributedLock(String lockName, LockManager manager) {
this.lockName = lockName;
this.manager = manager;
this.localhost = manager.getLocalhost();
} |
e980511d-2237-470a-86f9-4b62c079fbad | 1 | public Result getResult(int ix) {
if(this.results.size()>ix) {
this.sort();
return this.results.get(ix);
}
return null;
} |
82a38376-5269-4f86-9430-26b88b639f48 | 6 | private int orderImage(Order order){
int res=9;
if(order.getType()==OrderType.CON){
res=0;
}else if (order.getType()==OrderType.DEF){
res=2;
}else if (order.getType()==OrderType.ATT){
if (order.getOthBonus()==0){
res=4;
}else{res=5;}
}else if(order.getType()==OrderType.RAI){
res=7;
}
if... |
2260aff2-3d92-4268-834d-2a3173cd50ae | 4 | private EquationStep.eOperator setOperator(char op){
EquationStep.eOperator newOp = null;
switch(op)
{
case '+': newOp = EquationStep.eOperator.eOperator_Plus;
break;
case '-': newOp = EquationStep.eOperator.eOperator_Subtract;
break;
case '/': newOp = EquationStep.eOperator.eOperator_Divide;
break... |
2fa97cf1-d0a5-40b9-9249-b8cd1cd99d38 | 5 | public static void nextSlide(){
// Test whether there is a slide show
if (SafetyNet.slideShow != null){
// Retrieve the next slide ID if one is specified.
if ((0 < SafetyNet.slideShow.getTree().elementAt(currentSlideID).getNext())
&& (SafetyNet.slideShow.getTree().size() >= SafetyNet.slideShow.getTree().e... |
67f489ba-446d-4bf2-8aad-681c74e8474a | 7 | public <T> ResultSet queryDB(String query, ArrayList<T> sqlParam){
PreparedStatement ps = null;
ResultSet rs = null;
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);
... |
629fa263-e2af-4b1d-9355-7d8a2a8eaa3f | 9 | public String getConstructor()
{
String output = "";
for (int i=0; i<WIDTH; i++)
for (int j=0; j<HEIGHT; j++)
{ Tile.Type type = campus[i][j].getType();
if ((type == Type.GRASS || type == Type.LAND || type == Type.FLOWER) && campus[i][j].getDirection()==Direction.DOWN)
output += "campus["+i+"]["+... |
17119286-c43a-488c-b9ef-f197dfba087e | 8 | public void set(Object target, Object value) {
try {
if (writeMethod != null) {
try {
writeMethod.invoke(target, value);
} catch (InvocationTargetException e) {
if (e.getCause() instanceof Error) {
throw (Error)e.getCause();
} else if (e.getCause() instanceof RuntimeException) {
... |
e62dc86c-65b3-40f3-a869-7efd2c450960 | 2 | private void mapGameAction(int code, boolean isMouseMap) {
if (inputManager.getMaps(action).size() >= 3) {
inputManager.clearMap(action);
}
if (isMouseMap) {
inputManager.mapToMouse(action, code);
}
else {
inputManager.mapToKey(action, ... |
211eeb79-4368-4674-a7d8-c8cdf5fd569c | 0 | public boolean useDocumentSettings() {return this.useDocumentSettings;} |
83c42834-fb5c-4194-91d4-03795f8775a1 | 3 | public void run(){
while(ClientMain.runingSendBeacon){
PrintWriter writer = null;
try {
writer = new PrintWriter(ClientMain.socket.getOutputStream());
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
// TODO Auto-generated method stub
System.out.pri... |
10240ca9-ef31-42f7-9ea2-98109e7ace2a | 6 | public static <E extends Comparable<? super E>> Stack<E> sort(Stack<E> input) {
Stack<E> s1 = new Stack<>();
while (!input.isEmpty()) {
E e = input.pop();
if (s1.isEmpty() || (e.compareTo(s1.peek()) >= 0)) {
s1.push(e);
} else {
int co... |
5676d956-c2ee-4299-9646-307748025609 | 2 | public void setDirection(Point direction) {
if (direction.equals(invertDirection(this.direction))) {
if (invertedBevoreMoves >= INVERT_FREQUENCY_MAX) {
this.direction = invertDirection(getLastGlied().getDirection());
invert();
}
} else {
this.direction = direction;
}
} |
a71e0b9d-85dc-4a51-9c95-363543ed30c3 | 3 | boolean reachedMaxRaises() {
// return true if number of raise actions in history is greater than maxNumberOfRaises
int historySize = actionHistory.size();
if(historySize < maxNumberOfRaises)
return false;
for(int i = maxNumberOfRaises; i >= 1; i--) {
if(actionHistory.get(historySize - i) !=... |
0f44a78b-dda7-4b4e-9230-985e33db3ca7 | 8 | @Override
public void keyReleased(KeyEvent e) {
int KeyCode = e.getKeyCode();
if (KeyCode == KeyEvent.VK_A || KeyCode == KeyEvent.VK_LEFT) {
left = false;
}
if (KeyCode == KeyEvent.VK_D || KeyCode == KeyEvent.VK_RIGHT) {
right = false;
}
if (... |
c6517dd3-20a3-438f-b70e-7b0cde41e2fd | 8 | public void run(){
Integer minutos = 0 , segundos = 0, milesimas = 0;
//min es minutos, seg es segundos y mil es milesimas de segundo
String min="", seg="", mil="";
try {
//Mientras cronometroActivo sea verdadero entonces seguira
//aumentando el tiempo
... |
9259af48-82b7-4f22-a99e-ec00d6860b09 | 7 | final public ParList ParList() throws ParseException {
List<Name> l = null;
boolean v = false;
ParList p;
long i = LineInfo();
switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
case NAME:
l = NameList();
switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
case 72:
jj_consume_token(72);
jj_consume_tok... |
4e4cb606-fdc2-46b0-be81-00d2988952ba | 4 | public boolean equals(Message mes){
return content.equals(mes.getContent()) && authors.equals(mes.getAuthors())
&& hashtags.equals(mes.getHashtags()) && recipient.equals(mes.getRecipient()) || mes.id == id;
} |
87fbcf0e-5d39-4dab-b199-44fc219211f0 | 9 | public void triangulate() {
// body trojuhelniku, normala
Vector3D p1 = new Vector3D(),
p2 = new Vector3D(),
p3 = new Vector3D(),
n = new Vector3D();
// pocatecni barva
ColorRGB c = new ColorRGB(0, 0, 0);
// trojuhelnik
Triangle t;
// kroky pro triangulaci (delka, sirka, vyska)
double stepl,... |
3c357e3c-fd6e-490b-80e6-0641e889724d | 4 | public void reload() {
this.reloadConfig();
this.loadConfig();
pluginNameToWorlds.clear();
ConfigurationSection limit = getConfig().getConfigurationSection("limit");
for (String pluginName : limit.getKeys(false))
{
if (limit.isList(pluginName))
{
List<String> worldNames = limit.getStringList(plugi... |
4c996bb9-a14e-4de7-a541-d0b1e31665c3 | 3 | private void createActivity(JobMetaData meta, Allocation alloc, int lastvmId) {
HashMap<Integer, HashMap<Integer, String>> allocs = alloc
.getAllocations();
// First get the VM that will combine the mid results
System.out.println("DEBUG: Last VM still is " + lastvmId);
allocs.remove(lastvmId);
SlaveVM l... |
7cf46295-6a17-451a-b5e3-3e2b51f6db1b | 0 | public TruncateHelper()
{
super();
} |
60a59a21-0b51-4386-b496-cb0ef1689b00 | 3 | public void mouseMove(MouseEvent e){
if(WidgetMgr.MAIN_TAB_PANE.tabDragging){return;}
if(getY() == getTargetY(0)){
if(!moving){
Tween.to(this, ComponentAccessor.POSITION, 50)
.target(getX(), getTargetY(1))
.start(Widget... |
3f4142d7-2400-4fc0-abc8-ac7b7cdae686 | 3 | public static byte[] decryptBloc(byte[] in) {
byte[] tmp = new byte[in.length];
byte[][] state = new byte[4][Nb];
for (int i = 0; i < in.length; i++)
state[i / 4][i % 4] = in[i%4*4+i/4];
state = AddRoundKey(state, w, Nr);
for (int round = Nr-1; round >=1; round--) {
state = InvSubBytes(state);
sta... |
e0a55204-6fe9-4aca-8585-2924431289fd | 3 | public ExternalProcessor getProcessorByName(String name)
{
if(md_processors == null)
{
return null;
}
for(ExternalProcessor p : md_processors)
{
if(p.name.compareTo(name) == 0)
{
return p;
}
}
return null;
} |
a305627b-0770-46ce-b8dc-657f7f3eb544 | 5 | private static void appendJSONPair(StringBuilder json, String key, String value) throws UnsupportedEncodingException {
boolean isValueNumeric = false;
try {
if (value.equals("0") || !value.endsWith("0")) {
Double.parseDouble(value);
isValueNumeric = true;
... |
9bb8058f-a0a1-4cf8-a7f5-3a9ef9ea45b5 | 8 | public void updateRuleSuperiorityRelationCounter() throws TheoryException {
if (superiors.size() == 0) return;
switch (Conf.getReasonerVersion()) {
case 2:
for (Entry<String, Set<Superiority>> entry : superiors.entrySet()) {
RuleExt superiorRule = (RuleExt) factsAndAllRules.get(entry.getKey());
if (nul... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.