📄 applicationform.java
字号:
package com.sams.jxta.groups.student;
import net.jxta.membership.Authenticator;
import net.jxta.membership.MembershipService;
import net.jxta.credential.AuthenticationCredential;
/*
* An Application Form represents an Authenticator.
*
*/
public class ApplicationForm implements Authenticator{
private String studentName;
private float GPA;
private UniversityAdmissionsService admissionsService;
private AuthenticationCredential unsubscribedCredential;
/*
* Constructor
*/
public ApplicationForm(UniversityAdmissionsService admissionsService,
AuthenticationCredential unsubscribedCredential){
this.admissionsService = admissionsService;
this.unsubscribedCredential = unsubscribedCredential;
}
/*
* Returns a String representing the method Name
*/
public String getMethodName(){
return "ApplicationForm";
}
/*
* Returns the Authentication Credential
*/
public AuthenticationCredential getAuthenticationCredential(){
return unsubscribedCredential;
}
/*
* Returns the Source Membership Service
*/
public MembershipService getSourceService(){
return admissionsService;
}
/*
* This method checks if the Application Form is authenticated properly
* Only if the form is "filled" properly , can the peer join the Membership
* Service. Here we consider an Application Form as ready to join if
* the GPA is greater than 3.0 and a "non blank" name has been provided.
*
*/
public boolean isReadyForJoin(){
if(studentName == null || studentName.trim().equals(""))
return false;
if(GPA >3.0f)
return true;
else
return false;
}
/*
* Setter for the GPA
*/
public void setGPA(float GPA){
this.GPA = GPA;
}
/*
* Setter for the Student Name
*/
public void setStudentName(String studentName){
this.studentName=studentName;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -