method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
709eb81d-b9a3-40d0-af15-f41df3f73988 | 5 | private void checkAssignedJobs() {
long dif;
ServerSideJob j;
JobRecord jr;
final Collection<JobRecord> remove = new LinkedList<JobRecord>();
synchronized (activeJobs) {
Iterator<JobRecord> it = activeJobs.iterator();
while (it.hasNext()) {
... |
58415b1e-37ac-4d72-bfc5-43a409446a80 | 6 | public TreeSet<Literal> getLiteralsWithSameConflictLiterals(Literal origLiteral) {
if (isConflictRulesModified() || isConversionRulesModified()) {
updateModeConversionConflictRules();
}
TreeSet<Literal> sameConflictLiterals = sameConflictLiteralsStore.get(origLiteral);
if (null != sameConflictLiterals) retu... |
a77ac994-9b96-466a-bef0-afc9f6e8f121 | 5 | @Override
public void executeCurrentTasks() {
// System.out.println("Thread: " + threadId + " is executing a task");
setThreadState(THREAD_STATE.RUNNING);
// System.out.println("Task list size: " + taskList.size());
for (int i = 0; i < taskList.size(); i++) {
Task task = taskList.remove(i);
// System.o... |
11ce55d8-c179-42f5-bcdb-df9602094775 | 1 | private void bCheckActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bCheckActionPerformed
try {
App.ge.extractShapes(getGmlTextWrapped());
showRecognizeDialog(this);
} catch (XMLStreamException xsex) {
System.err.println(xsex.getMessage());
... |
f4b8722a-6f48-468b-a9ae-a61604989651 | 4 | public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
String path = ((HttpServletRequest) request).getRequestURI();
System.out.println(path);
HttpSession session = ((HttpServletRequest)request).getSession(false);
if (path.toLowerCase()... |
17c5276e-77e4-41b1-b8cc-8aac3c00d45b | 2 | /* */ public static void toggleGhostMode(Player player) {
/* 161 */ if (playerMap.containsKey(player))
/* */ {
/* 163 */ ArrayList<BlockState> blockStateList = (ArrayList<BlockState>)playerMap.get(player);
/* */
/* 165 */ for (BlockState blockState : blockStateList) {
/* 166 */ ... |
88406a2b-819a-4724-a3be-d6dd2477c676 | 3 | private void creerListesActivites() {
for (int i = 0; i < declaration.getNombreActivites(); i++) {
JSONObject jsonObject = declaration.getActivite(i);
Activite2012_2014 activite;
try {
activite = new Activite2012_2014(jsonObject);
activite.appl... |
84fbcbb2-74c1-4259-b8f7-926398551a08 | 9 | public boolean editCellAt(int index, EventObject e){
if(editor!=null && !editor.stopCellEditing())
return false;
if(index<0 || index>=getModel().getSize())
return false;
if(!isCellEditable(index))
return false;
if (editorRemover == null){ ... |
70018918-a3fd-40d6-afe2-5a4e398ec718 | 1 | private static boolean isSelectedElem(Integer id) {
return id != null && id != 0;
} |
cd2bb839-002f-41ec-9f9d-53a0d0827edc | 7 | VirtualMachine launchVM(String className) {
LaunchingConnector connector = theCommandLineLaunchConnector();
try {
java.util.Map<String, Connector.Argument> args
= connector.defaultArguments();
/* what are the other options? on my system,
for (java.... |
fa71869c-88c8-4c2b-811f-ebef3bdeb7db | 7 | public static void selectBuilding(Building building, Player player) {
int width = building.getWidth();
int height = building.getHeight();
int length = building.getLength();
Location baseLocation = building.getBottom();
if (playersSelectedBuilding.containsKey(player)) {
Building buildingToRemove = playersS... |
f16e8d19-9c81-46ff-b602-4b2f0f9f6f36 | 6 | public void startSinglePlayerGame(Specification specification,
String userName, Advantages advantages) {
freeColClient.setMapEditor(false);
if (freeColClient.isLoggedIn()) logout(true);
if (!unblockServer(FreeCol.getDefaultPort())) return;
loadMod... |
b206893b-ee42-4c50-af89-bf077a2dfd90 | 4 | @Override
public void run()
{
// Continuously sending the Proxy isAlive packages:
while (true) {
try {
Thread.sleep(this.isAlive);
} catch (InterruptedException e1) {
// Thread has been Interrupted.
System.out.println("File Server Datagram Thread has been broken off.");
return;
}
// S... |
85a9d123-e169-43e6-892b-71554818ee67 | 2 | public String toString()
{
String s = new String();
s += V() + " vertices " + E() + " edges\n";
for (int v = 0; v < V(); v++)
{
s += v + ": ";
for (WeightedEdge e : adj[v])
s += e + ", ";
s += "\n";
}
return s;
} |
01e4d760-4db3-4279-98c8-919f080d1f48 | 0 | private void reportError()
{
//System.out.println("ERROR ~ ERROR!");
} |
56978ea2-a3c7-4ef8-aa8a-f2cc389d09ca | 5 | public DataSetValidator result() {
// -- check all fields are set.
if (validator.name == null) throw new RuntimeException("The validator name has not been set!");
if (validator.expectedSize == null) throw new RuntimeException("The expected number of tuples has not been set!");
... |
f131e6b3-52f8-437e-a86c-f36525379f95 | 9 | private void test(List<Answer> allAnswers, List<Answer> possibleAnswers,
QuestionDifficulty difficulty, int incorrectMin, int incorrectMax) {
int lowestIncorrect = Integer.MAX_VALUE;
int highestIncorrect = Integer.MIN_VALUE;
int lowestCorrect = Integer.MAX_VALUE;
in... |
b5905322-8f3c-4e3e-92a8-b9e6631ad7c2 | 1 | private static void enableBackgrounds() throws IOException, InterruptedException {
try { // Once in a time there were a bug. This bug had it that the authui was correctly applied but not the background. XXX
ProgramLauncher.start(SystemInformation.getCMD64(), ENABLE_BG_CMD, true, null); // So, le me ... |
cb49d7b5-b928-4a43-ac61-a9fb1e5f7afe | 8 | public char readChar() throws IOException
{
switch ( type )
{
case MatDataTypes.miUINT8:
return (char)( buf.get() & 0xFF);
case MatDataTypes.miINT8:
return (char) buf.get();
case MatDataTypes.miUINT16:
return (char)(... |
3e69d601-b382-4178-a115-dd3caff67f97 | 9 | private void buildScoreTable(){
double final_score[] = new double[N+1];
int num = 0;
for (String key:norm.keySet())
{
try {
String path ="./index/" + key.trim() +".txt";
if(!new File(path).exists())
continue;
FileInputStream fStream = new FileInputStream(path);
DataIn... |
cf9657d0-7086-445e-a1c4-0f14e79593c6 | 5 | public Writer write(Writer writer) throws JSONException {
try {
boolean commanate = false;
Iterator keys = this.keys();
writer.write('{');
while (keys.hasNext()) {
if (commanate) {
writer.write(',');
}
... |
89c92372-cfe2-40e3-a072-0ea1200d070d | 1 | public void WheelUp()
{
switch(Main.Screen)
{
case "inGame":
objectPanel.wheelUp();
break;
}
} |
18d203e4-1d99-411f-91f0-b99911f3744d | 5 | public static Location getLFST(String str) {
String[] l = str.split(":");
if(l.length == 4) {
if(Bukkit.getWorld(l[0]) != null && isDouble(l[1]) && isDouble(l[2]) && isDouble(l[3])) {
return new Location(Bukkit.getWorld(l[0]), Double.parseDouble(l[1]), Double.parseDouble(l[2]... |
9a750977-0108-4a64-8991-ba27e1a4186e | 8 | protected String snorm(String name) {
if ("max".equals(name)) {
return Maximum.class.getSimpleName();
}
if ("sum".equals(name) || "probor".equals(name)) {
return AlgebraicSum.class.getSimpleName();
}
if ("bounded_sum".equals(name)) {
return Bou... |
77189807-5bf4-4cb0-8104-9425e80fd25a | 7 | private void checkRunBridge() {
client_bridge.setCandy(player.getCandy());
client_bridge.setMoney(player.getMoney());
// TODO Auto-generated method stub
if (client_bridge.isCreateAttackUnitRequest()) {
if (player.canCreateAttackingUnit(client_bridge.getAttackUnitId())) {
player.createAttackingUnit(client... |
0674f10a-101e-4579-9308-c811a306e031 | 5 | public void runGame() {
while (!isGameOver()) {
theView.playerStatus(player1);
theView.printToMoveOrToStay(player1.getLocation().getDescription(),
player1.getLocation().getNeighbor().getDescription());
int decision = userInput(3);
if (decision ... |
74e5dead-7d52-4231-829d-bba62abd3921 | 9 | public void run() {
Set<String> keys = this.gs.getMembershipList().getKeys();
ArrayList<String> randomKeys = new ArrayList<String>();
ArrayList<String> completedGossips = new ArrayList<String>();
Random rand = new Random();
int failedContactServers = 0;
//convert to arraylist for easier randomization
f... |
480be6b7-83a5-4033-a7b9-e94850a65c36 | 7 | public boolean descendre(float vitesse) {
boolean colision = false;
int DX = (int) (positionReelle.get(0) + vitesse / 4) - position.get(0), max;
Forme tempForme = new Forme(courante.getForme());
Vecteur<Integer> temp = new Vecteur();
for (max = 1; max <= DX; max++) {
... |
ae0dcd14-1c4c-4444-b400-b46193542a60 | 2 | public static LinkContentEnumeration fromValue(String v) {
for (LinkContentEnumeration c: LinkContentEnumeration.values()) {
if (c.value.equals(v)) {
return c;
}
}
throw new IllegalArgumentException(v);
} |
8690220e-2e59-4061-9275-3dabd1924c8d | 5 | public void hit(String shooterName, int markerID, String userMatch, String userTeam){
try{
ResultSet markerOwner = returnOwnerOfMarker(markerID, userMatch);
// Compares the credentials of the shooter with credentials of markerOwner, to check if:
if(markerOwner != null){
if(markerOwner.getString("host... |
2eeab20d-340e-41c5-a207-ec716ca65014 | 3 | public static void benchmarkProp(ProblemDefinition problem, String prop, double min, double max, double step) {
List<String> results = new ArrayList<>();
for (double stay = min; stay <= max; stay+= step) {
long ccost = 0;
long pcost = 0;
long besti =... |
3ea620e5-1072-4e2c-9830-14d5bf29b09b | 1 | public int getDimensions() {
int i = 1;
while (buf[off + i] == '[') {
++i;
}
return i;
} |
425e7b22-fe88-4c21-bfb8-9e0be0eb6f0a | 6 | private boolean IupdateEdge(String edge_id, Map<String,String> params)
{
boolean isUpdated = false;
OrientGraph graph = null;
try
{
graph = factory.getTx();
Edge edge = graph.getEdge(edge_id);
if(edge != null)
{
for (Map... |
33b8e41c-3c43-41ce-8055-21b9f2ea7de6 | 0 | public Queue<String> getUnsearchList(){
// this.unsearchList.add(getUnsearchList().);
//TODO read file
return null;
} |
a52a1250-fcbe-43b8-81ca-a10950c6de44 | 1 | public void setLoadKB(int kb) {
if (kb <= -1) {
kb = 0;
}
speedKB = kb;
} |
d0ac3134-a14b-4c44-8b80-95bd6781560d | 4 | private void removeRobot(int selected) {
if(selected == -1 || selected >= selectedRobots.size()) {
return;
}
selectedRobots.remove(selected);
int size = selectedRobots.size();
if(selected >= size) {
selected = size - 1;
}
selectedRobotList.setSelectedIndex(selected);
if(size == 0) {
okButton.se... |
9aab5dce-dd40-44a2-bc39-b67d789f3f6c | 7 | public static void main(String args[]) {
if(args.length < 2){
System.out.println("Server or port no not specified.");
System.exit(1);
}
DatagramSocket socket = null;
Scanner sc = new Scanner(System.in);
try {
socket = new DatagramSocket();
int portNo = Integer.valueOf(args[1]).intValue();
Inet... |
a88c4aa3-8954-49d3-b61d-be65d4b83bee | 9 | final int method2428(int i) {
anInt10200++;
Class225 class225 = method2422((byte) 72);
if (i != 2)
method2376(11);
int i_49_
= (((Class264) ((Mob) this).aClass264_10217)
.anInt3370);
boolean bool;
if (((Class225) class225).anInt2948 == 0)
bool
= (((Mob) this).aClass264_10217.method2020
... |
7fcfb103-ad8c-4b48-a4e4-6409799d4346 | 5 | public static ArrayList<Product> getAllPFromUser(int member_id){
try {
if(conn == null || conn.isClosed()){
conn = DatabaseConnection.getConnection();
}
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
ArrayList<Product> productLis... |
168c1992-71dc-4e9a-9716-9496fa16604f | 6 | public void run()
{
// reading the configuration file.
ConfigurationReader configuration = new ConfigurationReader(_configFile);
if (!configuration.readConfigurationFile())
{
System.out.println("Failed in reading configuration file.");
return;
}
_connector = SNConnectorFactory.getConnector(SNConne... |
9762680f-40e2-4b7b-a041-e0508e3eb425 | 9 | protected List<PhysicalAgent> loadItemsFromFile(Environmental scripted, String filename)
{
filename=filename.trim();
List items=(List)Resources.getResource("RANDOMITEMS-"+filename);
if(items!=null)
return items;
final StringBuffer buf=getResourceFileData(filename, true);
String thangName="null";
final R... |
2d813600-87b5-4eae-b2e5-bd940f719207 | 3 | public static void writeStatus() throws FileNotFoundException {
String out3 = new Integer(Gui.count).toString();
if (Gui.count < 10) {
out3 = "0" + out3;
}
if (Gui.count < 100) {
out3 = "0" + out3;
}
if (Gui.count < 1000) {
out3 = "0" + out3;
}
PrintStream out = new Print... |
0bd5a720-2da9-45f9-abf6-066725724f23 | 0 | public T getInternal() {
return internal;
} |
d658ba8c-4912-4f94-9b29-af1d6dc4f45e | 3 | public void selectGlyphs(ViewEventArgs args){
int start, end;
for (int i = this.selectionRange.getStartRow(); i <= this.selectionRange.getEndRow(); i++){
Row row = this.logicalDocument.getRows().get(i);
start = 0;
end = row.getUiGlyphs().size() - 1;
if (i == this.selectionRange.getStartRow()){
sta... |
582fc053-9edd-49dd-8971-fc95398f96d2 | 2 | public static void main(String[] args) {
try {
//Creating server socket
final ServerSocket servSocket = new ServerSocket(serverPort);
JOptionPane.showMessageDialog(null, "Сервер регистрации запущен!");
while (true) {
//Waiting for clients connectio... |
7092c5f2-960e-40de-90e8-046632e1e73b | 7 | public FATFile copyTo(FATFolder dst, boolean overwrite) throws IOException {
FATLock lockSrc = tryLockThrowInternal(false);
//deep copy instance
FATFile dstFile = null;
//child list snapshot
FATFile[] srcChildren = null;
try {
FATLock lockFolder = dst.asFile(... |
431bd9b5-b647-46df-9d93-a683c361efbc | 7 | public static String getName(int opcode) {
for (Field f : fields) {
if (f.getType().toString().equals("int")) {
if (f.getName().startsWith("ACC"))
continue;
if (f.getName().contains("_")) {
if (f.getName().indexOf("_") < 2)
... |
1e936ce0-c479-4441-a28d-21772beb53ea | 4 | @Override
public Iterator<EntityInfo> iterator() {
return new Iterator<EntityInfo>() {
Iterator<EntityInfo> use = inner.iterator();
private EntityInfo nextElement;
@Override
public boolean hasNext() {
EntityInfo info;
while (use.hasNext())
{
info = use.next();
if (!info.getFullP... |
cd757bbb-0ee2-42d7-b133-7eca327e8b61 | 9 | private String getCourseNumber(CourseData c){
BlockNode temp;
Iterator<BlockNode> library=courseList.iterator();
String courseNumber="";
int number=1;
char greek='\u03B1';
while(library.hasNext()){
temp=library.next();
//if a double is found
if(temp.courseInfo.subjectline.equals(c.subjectline)
... |
08deda47-3bb8-41b8-9ccc-5c2fea0b833a | 0 | public ChatLeftMessage(String name) {
this.name = name;
settings = Settings.getInstance();
} |
5270b567-0c89-412f-954c-329f6f2e1b78 | 4 | public static void main(String[] args){
Scanner in = new Scanner(System.in);
String s = in.next();
int n = in.nextInt();
allowed = n+s.length();
if(n >= s.length()){
System.out.println((n+s.length())%2==0?(n+s.length()):(n+s.length()-1));
} else {
for(int i=0;i<allowed;i++){
for(int j=i+1;j<... |
4bb8ad04-2d18-43ef-81ec-b03504f75ac6 | 9 | private void initEvents() {
if (Keyboard.isKeyDown(Keyboard.KEY_ESCAPE)) {
Display.destroy();
System.exit(0);
}
if (Keyboard.isKeyDown(Keyboard.KEY_RIGHT)) {
model.move(UserKeys.RIGHT);
}
if (Keyboard.isKeyDown(Keyboard.KEY_LEFT)) {
model.move(UserKeys.LEFT);
}
if (Keyboard.isKeyDown(Keyboard.... |
cca199f9-cce7-4113-84fe-1e85d719a0e2 | 7 | public void run(){
for(;;){
try {
//accept connection
socket = serverSocket.accept();
BufferedReader netListener = new BufferedReader(new InputStreamReader(socket.getInputStream()));
output = new DataOutputStream(socket.getOutputStream... |
f1e479c4-a323-4cb9-ac1c-f46d02403bab | 4 | public static BufferedImage[] splitImages(String path, int col, int row) {
BufferedImage image = null;
try{
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
InputStream input = classLoader.getResourceAsStream(path);
image = ImageIO.read(input);
}catch (IOException e) {
System... |
c6c697f9-72f3-4458-837b-c5ddbe8d5724 | 7 | public void handleInput() {
if(Keys.isPressed(Keys.ENTER)){
if(!win){
started++;
}else if(win){
gsm.nextLevel();
gsm.setState(GameStateManager.LOADINGSTATE);
}
}
if(Keys.isPressed(Keys.RIGHT)){
fast.startFlying();
}
if(Keys.isPressed(Keys.UP)){
fast.startJumping();
}
if(Keys.isPr... |
48b61ae6-34c3-4d68-8d6a-0e6edf807621 | 5 | private int calc(int y,int x)
{
int ins = matrix[y][x-1][0] +effort[1];
int del = matrix[y-1][x][0]+effort[0];
int dia = matrix[y-1][x-1][0];
if(s1[x-1]!=s2[y-1])
{
dia += effort [2];
}
//System.out.println(del+":"+ins+":"+dia);
if(del<=ins && del<=dia)
{
matrix[y][x][1]=1;
return del;
}
... |
3db44e63-b49b-44c1-8aed-47e524b0bb2a | 4 | public int buy() {
Output.printClockLn("Rubbellos", 1);
int bought = 0;
try {
for (int i = 0; i < count; i++) {
Utils.visit("kiosk/");
Utils.visit("kiosk/losKaufen/");
Utils.visit("kiosk/lose/");
JSONObject result = Utils.getJSON("kiosk/getLos");
String type = result.getString("type");... |
9486ec7c-8811-4928-8fc1-4a4e77196fcb | 5 | public void sortDeck() {
//Denotes when sorting has been complete
boolean isSorted = false;
//Denotes a switch has occurred during the for loop
boolean switchOccur = false;
int i;
//Holds the first Elemental object so it is not lost during the switch
Elemental placeholder;
if(getDeckLength() > 1)... |
2bc8155e-6575-41eb-9154-d32e7fb0d5a9 | 3 | ParamSet() {
for (final BruteParams<?> p : BruteParams.valuesLocal()) {
if (p == null) {
continue;
}
this.params.put(p, null);
}
} |
93c22907-f3f0-43f2-ad5c-f82fe1caf7c4 | 0 | public JButton getButtonEditFile(){
return buttonEditFile;
} |
a6ee53c0-d479-43d3-8f65-38f4d6eb5c34 | 6 | public int Add_Data(ProfileInfo DataObj) {
//System.out.println("ProfileDAO.Add_Data()");
int res = 0;
ProfileInfo profileObj = null;
String sql = "INSERT INTO profile VALUES(?,?,?,?,?,?,?,?,?,?)";
try {
profileObj = (ProfileInfo)DataObj;
con = getConnection();
pstmt = con.prepareStat... |
bff344d5-add1-4049-b6e8-3e6f92c76775 | 2 | public static void handleMouse(EngineState engineState){
while(Mouse.next() == true){
int button = Mouse.getEventButton();
int x = Mouse.getEventX();
int y = Mouse.getEventY();
boolean pressed = Mouse.getEventButtonState();
if(pressed){
... |
c5d31a20-0ab9-440f-814d-e44fdb69c8ff | 1 | public List<ExtensionsType> getExtensions() {
if (extensions == null) {
extensions = new ArrayList<ExtensionsType>();
}
return this.extensions;
} |
784d65f0-cf24-4844-b1c8-c56dcc57039d | 2 | private void convertToCNF(CNFConverter converter, Production p)
{
if (!converter.isChomsky(p))
{
Production temp[]=converter.replacements(p);
for (int j=0; j<temp.length; j++)
{
p=temp[j];
convertToCNF(converter, p);
}
}
else
myTempCNF.add(p);
} |
ed8c797c-6705-466c-b328-821f9ce1dbf5 | 2 | public void run() {
try {
Object request = ttp.receive();
String targetPath = request.toString();
Object file = getFile(targetPath);
ttp.send(file);
System.out.println("Send file: " + targetPath);
ttp.close();
} catch (IOException e) {
e.printStackTrace();
} catch (ClassNotFoundException ... |
8a4cc9c1-b73d-4777-bde6-79240390ca93 | 5 | public void renderTo(BufferedImage image, Matrix2D matrix)
{
Vector2d screenPos = matrix.transform(0, 0);
double delta = lastUpdated - screenPos.x;
if (Math.abs(delta) > 1) {
shift((int)delta);
lastUpdated -= delta;
}
// RENDER
Colour col = new Colour(0x6699FF);
int midOnScreen = (int) matrix.tr... |
4aa609b9-838d-47f5-9edc-d60c7e752c89 | 0 | @Override
public void endSetup(Attributes atts) {} |
88c84ea6-d0aa-4405-8a53-c7f34b0a080d | 4 | private void optimizeGeschichte(){
// Geschichte: 2 hjs mandatory
// If wESubect, quota already filled
if(myData.subjects[GESCHICHTE].writtenExamSubject==false){
int hjsToAdd;
Semester bestSemester;
if(myData.subjects[GESCHICHTE].oralExamSubject==true){
... |
c1ebd73c-0f83-4a97-b661-9834abb4f867 | 9 | public List<Computer> getListComputer(Wrapper computerWrapper) throws SQLException, ClassNotFoundException {
Connection cn=DaoFactory.getInstance().getConnection();
ArrayList<Computer> listComputer = new ArrayList<Computer>();
ResultSet rs = null ;
PreparedStatement stmt = null;
if(computerWrapper.getFilter... |
0d9aae6c-4f56-4ddc-baa2-633550726470 | 1 | public List<T> getCurrentValues() {
List<T> values = new ArrayList<T>();
for (int i = 0; i < count(); i++) {
values.add(getValue(i));
}
return values;
} |
6a28a06a-dde6-476e-9982-9f14f8282739 | 1 | private boolean stringChecker(String input)
{
boolean stringTooLong = false;
if(input.length() >= 32)
{
stringTooLong = true;
}
return stringTooLong;
} |
2096813c-0e8d-4f6e-9aca-96acec191868 | 4 | @SuppressWarnings("static-access")
@EventHandler(priority = EventPriority.HIGH)
public void onMobDeath (EntityDeathEvent event) {
Entity entity = event.getEntity();
if (entity instanceof Skeleton) {
Skeleton possessedItem = (Skeleton) entity;
if (MMPossessedItem.isPossess... |
abe6768d-e80d-4b43-abf3-7b9253918b1f | 7 | public boolean UpdatePerson(long idperson, String pass, String fname,
String lname, String address, String city, String state,
String zipcode, String persontype, String department, String officeHr, String location) throws SQLException {
int rowcount = 0;
boolean result = false;
String query,query1="";... |
fc79f3cc-379f-4f84-a05b-600eb8c83ee1 | 6 | public static void main(String[]args) {
Socket socket = null;
String recvData = "";
String data = ""; //消息编号
try {
socket = new Socket(settingData.LightIP,settingData.LightMainPort);
reader = new BufferedReader(new InputStreamReader
(socket.getInputStream()));
writer = new BufferedWriter(new ... |
406eb7e6-d8bf-49a6-933a-7eeffbee297c | 4 | public static String getIDFromConfig(String mode, String setting) {
JSONArray modsArray = (JSONArray) IDConfig.get(mode);
if (modsArray != null) {
for (Object obj : modsArray.toArray()) {
JSONObject mod = (JSONObject) obj;
String modname = (String) mod.get("... |
a4d1de13-7bbb-4d34-82b1-d0851d7623b1 | 5 | public boolean putHutteIsValid(FjordePlayer p) {
boolean b = false;
if (p.getNbHutte() == 0)
return b;
// On ne peut pas poser une hutte sur les tuiles de depart
if (!this.isStart()) {
int cpt = 0; // Nombre de somments montagne sur la tuile
for (int... |
48647b3a-b791-41ff-9dc5-c91364f34dfb | 3 | public static int getBest(int ID) {
int result = listFields.size() - 1;
double points = 0;
boolean start = false;
for (int i = 0; i < listFields.size() - 1; i++) {
double newPoints = 0;
newPoints = newPoints + points_for_distance(i, ID);
newPoints = newPoints + points_for_enemy(i, ID);
newPoints ... |
6d12eeb5-d0e3-4ace-a23f-7876703ad3e6 | 8 | protected void addPackageTreeLinks(Content contentTree) {
//Do nothing if only unnamed package is used
if (packages.length == 1 && packages[0].name().length() == 0) {
return;
}
if (!classesonly) {
Content span = HtmlTree.SPAN(HtmlStyle.packageHierarchyLabel,
... |
f963eee1-e125-470e-896d-3a5ad229be7d | 6 | public AStarNode findPath(AStarNode start, AStarNode destination) {
// Push start to open.
aStar.addOpen(start);
while (aStar.isOpenNodeAvailable()) {
AStarNode current = aStar.obtainOpenNodeWithLowestCost();
if (current.isTouching(destination)) {
return current;
} else {
aStar.addClosed(current)... |
e962fde1-8a2e-422a-9ee3-1d448ca63e2c | 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... |
4615ea1c-fbe5-4625-8636-481143de1dac | 5 | public static boolean run(int num) {
char[] n = (num + "").toCharArray();
int mask = 0, used = 0, pos = 0;
for (int i = 0; i < n.length; i++) {
if (n[i] == '0' || (mask & (1 << (n[i] - '0'))) != 0)
return false;
mask |= (1 << (n[i] - '0'));
}
mask = 0;
do {
if ((mask & (1 << pos)) != 0)
ret... |
21b919be-90af-47d0-9f48-475c8ae260b0 | 3 | public void CalcTangents()
{
for(int i = 0; i < m_indices.size(); i += 3)
{
int i0 = m_indices.get(i);
int i1 = m_indices.get(i + 1);
int i2 = m_indices.get(i + 2);
Vector3f edge1 = m_positions.get(i1).Sub(m_positions.get(i0));
Vector3f edge2 = m_positions.get(i2).Sub(m_positions.get(i0));
floa... |
f4e31f6a-b67f-4f2f-9061-f977611349fe | 6 | private static boolean start(ObjectOutputStream toServer, ObjectInputStream fromServer, Scanner scanner) throws IOException, ClassNotFoundException {
log.debug("Start method \"start\"");
System.out.println("1 - registration, 2 - login, 0 - exit");
String scan = scanner.next().toLowerCase();
... |
ab3df556-4cb8-43af-99c0-a41b63325b02 | 2 | public static int getTotalQuizTakenRecord() {
int totalRecords = 0;
try {
String statement = new String("SELECT COUNT(id) FROM " + DBTable);
PreparedStatement stmt = DBConnection.con.prepareStatement(statement);
ResultSet rs = stmt.executeQuery();
if (rs.next())
totalRecords = rs.getInt("COUNT(id)")... |
916ae147-c601-4d6c-a950-6a030694b93d | 1 | public void eval(EvalContext context) {
int stmtId = context.newStmtId();
context.logEntering("Calling function <" + name + ">@" + stmtId + " ctx@" + context.id);
int len = params.length;
for(int i=len-1; i>=0; i--) {
params[i].eval(context);
}
context.invokeF... |
9c63fe91-4a83-49c6-861d-593526fbfb6f | 6 | @Override
/**
* The functions determines whether a word is in the Trie.
*
* @param obj The only way this will return a true is if the object passed in
* is a String and this Trie contains that String.
*/
public boolean contains( Object obj) {
if(!(obj instanceof String)){
return false;
}
String wo... |
a261be8c-e234-4ded-8ea7-435b98e3cb0f | 6 | public void saveFields() {
HashMap<String,String> allFields = new HashMap<String,String>();
Field [] fields = this.getClass().getDeclaredFields();
for (Field field : fields) {
field.setAccessible(true);
// Store Checkboxes as true or false
if (field.getType() == JCheckBox.class) {
try {
... |
b6a23921-8aa4-4b06-803e-b73d2ddac527 | 6 | public String chi2(HashMap<String, String> treeChoises) {
HashMap<String, Integer> partialFrequenzies = getPartialFrequenzies(treeChoises);
double numerator = 0;
double denominator = 0;
for (String key : partialFrequenzies.keySet()) {
denominator += frequenzy.get(key);
numerator += partialFrequenzies.get... |
62d2b014-15c1-418e-a712-8c635beac345 | 2 | public int Consulta(int n){
Menu menu = new Menu();
Statement consulta = menu.conexion();
try{
ResultSet resultado = consulta.executeQuery("SELECT * FROM tblproductos "
+ "WHERE Codigo="+n);
if(resultado.next()==true){
... |
afea9293-b204-4d8c-87a5-1b5ab8775d90 | 5 | public void setSpeed(double speed) {
if (speed >= 0 && speed <= 100) {
this.speed = speed;
if (model.isPlaying() && animationTask != null) {
animationTask.cancel();
animationTask = new AnimationTask(this);
if (speed > 0) {
... |
4b27ffe0-313c-43eb-8b34-16b23824b275 | 7 | private void visitNode(BinaryNode<K, V, W> node, String s) {
if(node.left != null){
if(s.equals(node.address)){
System.out.println(node.value+", "+" rollnumber: "+node.key);
}
visitNode(node.left,s);
}
if(node.right != null) {
if(s.equals(node.address)){
System.out.println(node.va... |
13fa944a-a2cd-43fb-af24-26cb8aeabbc8 | 1 | private String getFormatFeedback(String feedbackInput){
try{
return feedbackInput.substring(0, 1)+"b"+feedbackInput.substring(1, 2)+"w";
} catch (Exception e){
return "0b0w";
}
} |
78afa482-94d8-4c12-8c26-972c1e309d3f | 4 | public void render ( Graphics gr, int cx, int cy ) {
int offx = -cx + LD22Game.WIDTH / 2;
int offy = -cy + LD22Game.HEIGHT / 2;
for ( int i = 0; i < numUsed; i++ ) {
int p = ( (firstUsed+i) % MAX_PARTS ) * NUM_FIELDS;
if ( particles[ p + FIELD_L ] > 0 && particles[ p + FIELD_A ] > 0 ) {
Image img = t... |
ca26cc5c-157d-4367-b2fc-180495b9f818 | 8 | private boolean appletCheck(boolean msg){
boolean isApplet;
SecurityManager s = System.getSecurityManager();
if(s != null){
try{
s.checkAccess(Thread.currentThread());
isApplet = true;
if(msg)
... |
68318233-fcbd-4e0c-919d-fe7d61021114 | 7 | private String getLine(int n) {
String[] hold = script[n].split(":");
switch (hold[0]) {
case "DEPT":
return DEPT.get(hold[1]);
case "POS":
return hold[1];
case "COLLAB":
return hold[1];
case "GROUP":
return hold[1];
case "STAGE":
return hold[1];
case "EMPLOYE":
return EMPL... |
76a0c170-069f-48de-89a0-79c352f6ef79 | 8 | public static HashMap<String,ArrayList<String>> readTablesList(){
ArrayList<String> res=rfa.readFilePath(resetPath+File.separator+"tables.properties", "UTF-8");
if(res==null){
Log.Print("tables.properties配置文件不存在!"); return null;
}
HashMap<String,ArrayList<String>> tlur= new H... |
3c395483-e473-4d05-a45a-4931efc10e91 | 6 | public static void main(String[] args) {
// TODO Auto-generated method stub
//Get java.lang.Class object corresponding to MyAppForReflection class: compile time process
Class<?> cObjCmplTm = MyAppForReflection.class;
//Simple class name
System.out.println("Fully qualified class name: "+cObjCmplTm.getN... |
400a9286-c9ff-4406-9b6c-83976edcdce2 | 1 | public void visit_pop(final Instruction inst) {
stackHeight -= 1;
if (stackHeight < minStackHeight) {
minStackHeight = stackHeight;
}
} |
75fe3fc6-8c02-4f03-9a7f-b44ce054d550 | 9 | */
IndentInfo unindent(int row) {
StringBuilder sb = code.get(row).sbuild;
int cellCount = 0, charCount = 0;
// Calculate the number of cells by which this line appears to be indented
while (charCount < sb.length() && Character.isWhitespace(sb.charAt(charCount))) {
if (sb.charAt(charCount++) == ... |
256a7764-fb55-44fa-988d-38a824167780 | 7 | private byte getData(int x, int z, int x2, int z2, Material type) {
if (x == x2) {
if (z < z2)
return (byte) (type == Material.JACK_O_LANTERN ? 0 : 2);
return (byte) (type == Material.JACK_O_LANTERN ? 2 : 0);
}
if (x < x2)
return (byte) (type == Material.JACK_O_LANTERN ? 3 : 1);
return (byte) (type... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.